MCPcopy Index your code
hub / github.com/git/git / match_object_header_date

Function match_object_header_date

date.c:850–871  ·  view source on GitHub ↗

* Parse a string like "0 +0000" as ancient timestamp near epoch, but * only when it appears not as part of any other string. */

Source from the content-addressed store, hash-verified

848 * only when it appears not as part of any other string.
849 */
850static 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 */

Callers 1

parse_date_basicFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected