[quote user="pmuser"]
Thanks guys, these are very interesting information. Just a few additional queries:
- What does the "mtime" field stands for? The equivalent of date field or something else?
[/quote]
"mtime" is a crude hash value based on the date which is used only when
sorting the folder. The code which calculates this value is as follows:
long extract_time (char *s)
{
int year, mon, day, hour, min, i;
char monthstr [10], *base;
long l;
/* Extract a date in RFC-822 date format, and:
** i: Sprintf() it into a consistent format for display.
** ii: Calculate a sequence value. The sequence value is
** used for sorting by date, and is crudely calculated.
** It is very nominally the number of minutes since
** Jan 1 1990, but in fact it ends up being nothing like
** this. This doesn't matter provided the sequence it
** produces is correct (which it is).
*/
if (s [3] == ',')
base = s + 4;
else
base = s;
if (sscanf (base, "%d %s %d %d:%d", &day, monthstr, &year,
&hour, &min) != 5)
return 0L;
for (mon = 0, i = 0; i < 12; i ++)
if (stricmp (monthstr, months ) == 0)
{
mon = i;
break;
}
if (year > 1900) year -= 1900;
l = (year - 90) * 535680L; /* 12 * 31 * 1440 (months) */
l += (mon * 44640L); /* 31 * 1440 (days) */
l += (day * 1440L); /* 60 * 24 hours */
l += (hour * 60L); /* 60 minutes */
l += min;
sprintf (s, "%2d %s %02d %2d:%02d", day, monthstr, year, hour, min);
return l;
}
[quote user="pmuser"]<p>Thanks guys, these are very interesting information. Just a few additional queries:</p>
<ul>
<li>What does the "mtime" field stands for? The equivalent of date field&nbsp;or something else?</li></ul><p> [/quote]</p><p>
"mtime" is a crude hash value based on the date which is used only when
sorting the folder. The code which calculates this value is as follows:
&nbsp;&nbsp;&nbsp; long extract_time (char *s)
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; int year, mon, day, hour, min, i;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; char monthstr [10], *base;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; long l;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; /*&nbsp; Extract a date in RFC-822 date format, and:
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; **&nbsp; i:&nbsp;&nbsp; Sprintf() it into a consistent format for display.
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; **&nbsp; ii:&nbsp; Calculate a sequence value. The sequence value is
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; **&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; used for sorting by date, and is crudely calculated.
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; **&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; It is very nominally the number of minutes since
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; **&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Jan 1 1990, but in fact it ends up being nothing like
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; **&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; this. This doesn't matter provided the sequence it
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; **&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; produces is correct (which it is).
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; */
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; if (s [3] == ',')
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; base = s + 4;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; else
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; base = s;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; if (sscanf (base, "%d %s %d %d:%d", &amp;day, monthstr, &amp;year,
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &amp;hour, &amp;min) != 5)
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; return 0L;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; for (mon = 0, i = 0; i &lt; 12; i ++)
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; if (stricmp (monthstr, months [i]) == 0)
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; mon = i;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; break;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; if (year &gt; 1900) year -= 1900;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; l = (year - 90) * 535680L;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; /* 12 * 31 * 1440 (months) */
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; l += (mon * 44640L);&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; /* 31 * 1440 (days)&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; */
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; l += (day * 1440L);&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; /* 60 * 24 hours&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; */
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; l += (hour * 60L);&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; /* 60 minutes&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; */
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; l += min;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; sprintf (s, "%2d %s %02d %2d:%02d", day, monthstr, year, hour, min);
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; return l;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }
&nbsp;</p><p>&nbsp;</p>
--
Han van den Bogaerde - support@vandenbogaerde.net
Member of Pegasus Mail Support Group.
My own Pegasus Mail related web information:
http://www.vandenbogaerde.net/pegasusmail/