diff options
author | Gregory Nutt <gnutt@nuttx.org> | 2015-04-14 08:12:45 -0600 |
---|---|---|
committer | Gregory Nutt <gnutt@nuttx.org> | 2015-04-14 08:12:45 -0600 |
commit | 4bedd7bd43261689719754a10cd08f834e097a17 (patch) | |
tree | f5ce0211128723241844f710fa44b7c6fc5421f5 /nuttx | |
parent | 48b717ed07864f1b737eef671642249ae051c312 (diff) | |
download | px4-nuttx-4bedd7bd43261689719754a10cd08f834e097a17.tar.gz px4-nuttx-4bedd7bd43261689719754a10cd08f834e097a17.tar.bz2 px4-nuttx-4bedd7bd43261689719754a10cd08f834e097a17.zip |
libc/time/lib_localtime.c: Move tzset(); it belongs in the Public Functions grouping
Diffstat (limited to 'nuttx')
-rw-r--r-- | nuttx/libc/time/lib_localtime.c | 110 |
1 files changed, 55 insertions, 55 deletions
diff --git a/nuttx/libc/time/lib_localtime.c b/nuttx/libc/time/lib_localtime.c index 246aaab41..871bf9d7d 100644 --- a/nuttx/libc/time/lib_localtime.c +++ b/nuttx/libc/time/lib_localtime.c @@ -1628,61 +1628,6 @@ static void tzsetwall(void) settzname(); } -void tzset(void) -{ - FAR const char *name; - - name = getenv("TZ"); - if (name == NULL) - { - tzsetwall(); - return; - } - - if (lcl_is_set > 0 && strcmp(lcl_TZname, name) == 0) - { - return; - } - - lcl_is_set = strlen(name) < sizeof lcl_TZname; - if (lcl_is_set) - { - (void)strcpy(lcl_TZname, name); - } - - if (lclptr == NULL) - { - lclptr = malloc(sizeof *lclptr); - if (lclptr == NULL) - { - settzname(); /* all we can do */ - return; - } - } - - if (*name == '\0') - { - /* User wants it fast rather than right */ - - lclptr->leapcnt = 0; /* so, we're off a little */ - lclptr->timecnt = 0; - lclptr->typecnt = 0; - lclptr->ttis[0].tt_isdst = 0; - lclptr->ttis[0].tt_gmtoff = 0; - lclptr->ttis[0].tt_abbrind = 0; - (void)strcpy(lclptr->chars, GMT); - } - else if (tzload(name, lclptr, TRUE) != 0) - { - if (name[0] == ':' || tzparse(name, lclptr, FALSE) != 0) - { - (void)gmtload(lclptr); - } - } - - settzname(); -} - /* The easy way to behave "as if no library function calls" localtime * is to not call it, so we drop its guts into "localsub", which can be * freely called. (And no, the PANS doesn't require the above behavior, @@ -2500,6 +2445,61 @@ static time_t time1(FAR struct tm *const tmp, * Public Functions ****************************************************************************/ +void tzset(void) +{ + FAR const char *name; + + name = getenv("TZ"); + if (name == NULL) + { + tzsetwall(); + return; + } + + if (lcl_is_set > 0 && strcmp(lcl_TZname, name) == 0) + { + return; + } + + lcl_is_set = strlen(name) < sizeof lcl_TZname; + if (lcl_is_set) + { + (void)strcpy(lcl_TZname, name); + } + + if (lclptr == NULL) + { + lclptr = malloc(sizeof *lclptr); + if (lclptr == NULL) + { + settzname(); /* all we can do */ + return; + } + } + + if (*name == '\0') + { + /* User wants it fast rather than right */ + + lclptr->leapcnt = 0; /* so, we're off a little */ + lclptr->timecnt = 0; + lclptr->typecnt = 0; + lclptr->ttis[0].tt_isdst = 0; + lclptr->ttis[0].tt_gmtoff = 0; + lclptr->ttis[0].tt_abbrind = 0; + (void)strcpy(lclptr->chars, GMT); + } + else if (tzload(name, lclptr, TRUE) != 0) + { + if (name[0] == ':' || tzparse(name, lclptr, FALSE) != 0) + { + (void)gmtload(lclptr); + } + } + + settzname(); +} + FAR struct tm *localtime(FAR const time_t * const timep) { tzset(); |