Revision 3227 libsylph/procheader.c
| procheader.c (revision 3227) | ||
|---|---|---|
| 840 | 840 |
if (result == 6) return 0; |
| 841 | 841 |
|
| 842 | 842 |
*zone = '\0'; |
| 843 |
result = sscanf(str, "%d-%2s-%2d %2d:%2d:%2d", |
|
| 844 |
year, month, day, hh, mm, ss); |
|
| 845 |
if (result == 6) return 0; |
|
| 846 |
|
|
| 843 | 847 |
result = sscanf(str, "%10s %d %9s %d %2d:%2d", |
| 844 | 848 |
weekday, day, month, year, hh, mm); |
| 845 | 849 |
if (result == 6) return 0; |
| ... | ... | |
| 882 | 886 |
} |
| 883 | 887 |
|
| 884 | 888 |
month[3] = '\0'; |
| 885 |
for (p = monthstr; *p != '\0'; p += 3) {
|
|
| 886 |
if (!g_ascii_strncasecmp(p, month, 3)) {
|
|
| 887 |
dmonth = (gint)(p - monthstr) / 3 + 1; |
|
| 888 |
break; |
|
| 889 |
if (g_ascii_isdigit(month[0])) {
|
|
| 890 |
dmonth = atoi(month); |
|
| 891 |
} else {
|
|
| 892 |
for (p = monthstr; *p != '\0'; p += 3) {
|
|
| 893 |
if (!g_ascii_strncasecmp(p, month, 3)) {
|
|
| 894 |
dmonth = (gint)(p - monthstr) / 3 + 1; |
|
| 895 |
break; |
|
| 896 |
} |
|
| 889 | 897 |
} |
| 890 | 898 |
} |
| 891 | 899 |
|
| ... | ... | |
| 901 | 909 |
|
| 902 | 910 |
timer = mktime(&t); |
| 903 | 911 |
if (timer == -1) {
|
| 904 |
if (dest) |
|
| 905 |
dest[0] = '\0'; |
|
| 906 |
return 0; |
|
| 912 |
if (year >= 2038) {
|
|
| 913 |
g_warning("mktime: date overflow: %s", src);
|
|
| 914 |
timer = G_MAXINT - 12 * 3600; |
|
| 915 |
} else {
|
|
| 916 |
g_warning("mktime: can't convert date: %s", src);
|
|
| 917 |
if (dest) |
|
| 918 |
dest[0] = '\0'; |
|
| 919 |
return 0; |
|
| 920 |
} |
|
| 907 | 921 |
} |
| 908 | 922 |
|
| 909 |
tz_offset = remote_tzoffset_sec(zone); |
|
| 910 |
if (tz_offset != -1) |
|
| 911 |
timer += tzoffset_sec(&timer) - tz_offset; |
|
| 923 |
if (timer < G_MAXINT - 12 * 3600) {
|
|
| 924 |
tz_offset = remote_tzoffset_sec(zone); |
|
| 925 |
if (tz_offset != -1) |
|
| 926 |
timer += tzoffset_sec(&timer) - tz_offset; |
|
| 927 |
} |
|
| 912 | 928 |
|
| 913 | 929 |
if (dest) |
| 914 | 930 |
procheader_date_get_localtime(dest, len, timer); |
Also available in: Unified diff