Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(481)

Side by Side Diff: fusl/src/time/mktime.c

Issue 1573973002: Add a "fork" of musl as //fusl. (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: Created 4 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « fusl/src/time/localtime_r.c ('k') | fusl/src/time/nanosleep.c » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 #include "time_impl.h"
2 #include <errno.h>
3
4 time_t mktime(struct tm *tm)
5 {
6 struct tm new;
7 long opp;
8 long long t = __tm_to_secs(tm);
9
10 __secs_to_zone(t, 1, &new.tm_isdst, &new.__tm_gmtoff, &opp, &new.__tm_zo ne);
11
12 if (tm->tm_isdst>=0 && new.tm_isdst!=tm->tm_isdst)
13 t -= opp - new.__tm_gmtoff;
14
15 t -= new.__tm_gmtoff;
16 if ((time_t)t != t) goto error;
17
18 __secs_to_zone(t, 0, &new.tm_isdst, &new.__tm_gmtoff, &opp, &new.__tm_zo ne);
19
20 if (__secs_to_tm(t + new.__tm_gmtoff, &new) < 0) goto error;
21
22 *tm = new;
23 return t;
24
25 error:
26 errno = EOVERFLOW;
27 return -1;
28 }
OLDNEW
« no previous file with comments | « fusl/src/time/localtime_r.c ('k') | fusl/src/time/nanosleep.c » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698