* Parse a string like "0 +0000" as ancient timestamp near epoch, but * only when it appears not as part of any other string. */
| 848 | * only when it appears not as part of any other string. |
| 849 | */ |
| 850 | static int match_object_header_date(const char *date, timestamp_t *timestamp, int *offset) |
| 851 | { |
| 852 | char *end; |
| 853 | timestamp_t stamp; |
| 854 | int ofs; |
| 855 | |
| 856 | if (*date < '0' || '9' < *date) |
| 857 | return -1; |
| 858 | stamp = parse_timestamp(date, &end, 10); |
| 859 | if (*end != ' ' || stamp == TIME_MAX || (end[1] != '+' && end[1] != '-')) |
| 860 | return -1; |
| 861 | date = end + 2; |
| 862 | ofs = strtol(date, &end, 10); |
| 863 | if ((*end != '\0' && (*end != '\n')) || end != date + 4) |
| 864 | return -1; |
| 865 | ofs = (ofs / 100) * 60 + (ofs % 100); |
| 866 | if (date[-1] == '-') |
| 867 | ofs = -ofs; |
| 868 | *timestamp = stamp; |
| 869 | *offset = ofs; |
| 870 | return 0; |
| 871 | } |
| 872 | |
| 873 | |
| 874 | /* timestamp of 2099-12-31T23:59:59Z, including 32 leap days */ |