MCPcopy Create free account
hub / github.com/git/git / gm_time_t

Function gm_time_t

date.c:48–66  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

46};
47
48static time_t gm_time_t(timestamp_t time, int tz)
49{
50 int minutes;
51
52 minutes = tz < 0 ? -tz : tz;
53 minutes = (minutes / 100)*60 + (minutes % 100);
54 minutes = tz < 0 ? -minutes : minutes;
55
56 if (minutes > 0) {
57 if (unsigned_add_overflows(time, minutes * 60))
58 die("Timestamp+tz too large: %"PRItime" +%04d",
59 time, tz);
60 } else if (time < -minutes * 60)
61 die("Timestamp before Unix epoch: %"PRItime" %04d", time, tz);
62 time += minutes * 60;
63 if (date_overflows(time))
64 die("Timestamp too large for this system: %"PRItime, time);
65 return (time_t)time;
66}
67
68/*
69 * The "tz" thing is passed in as this strange "decimal parse of tz"

Callers 1

time_to_tmFunction · 0.85

Calls 2

date_overflowsFunction · 0.85
dieFunction · 0.70

Tested by

no test coverage detected