diff options
author | Jim Meyering <jim@meyering.net> | 1996-09-06 03:18:46 +0000 |
---|---|---|
committer | Jim Meyering <jim@meyering.net> | 1996-09-06 03:18:46 +0000 |
commit | f709048a826d7b28f36868257896b037652278fd (patch) | |
tree | 203c448f892cc7f26165e2a5bfe629001168fe0f | |
parent | d1f996b486b48d6bd429fd2ff52598bb5e29a0f1 (diff) | |
download | coreutils-f709048a826d7b28f36868257896b037652278fd.tar.xz |
revert last change
-rw-r--r-- | lib/strftime.c | 40 |
1 files changed, 15 insertions, 25 deletions
diff --git a/lib/strftime.c b/lib/strftime.c index 8b7f2a887..abcae166c 100644 --- a/lib/strftime.c +++ b/lib/strftime.c @@ -472,37 +472,27 @@ strftime (s, maxsize, format, tp) case 'z': { struct tm tml = *tp; + time_t t = mktime (&tml); struct tm tmg; - time_t t; - time_t offset = 0; int diff; - t = __mktime_internal (&tml, __localtime_r, &offset); + tml = *localtime (&t); /* Canonicalize the local time. */ + tmg = *gmtime (&t); - /* Canonicalize the local time. */ - if (t == (time_t) -1 || __localtime_r (&t, &tml) == NULL) - /* We didn't managed to get the local time. Assume it - GMT as a reasonable default value. */ - diff = 0; - else + /* Compute the difference. */ + diff = tml.tm_min - tmg.tm_min; + diff += 60 * (tml.tm_hour - tmg.tm_hour); + + if (tml.tm_mon != tmg.tm_mon) { - __gmtime_r (&t, &tmg); - - /* Compute the difference. */ - diff = tml.tm_min - tmg.tm_min; - diff += 60 * (tml.tm_hour - tmg.tm_hour); - - if (tml.tm_mon != tmg.tm_mon) - { - /* We assume no timezone differs from UTC by more - than +- 23 hours. This should be safe. */ - if (tmg.tm_mday == 1) - tml.tm_mday = 0; - else /* tml.tm_mday == 1 */ - tmg.tm_mday = 0; - } - diff += 1440 * (tml.tm_mday - tmg.tm_mday); + /* We assume no timezone differs from UTC by more than + +- 23 hours. This should be safe. */ + if (tmg.tm_mday == 1) + tml.tm_mday = 0; + else /* tml.tm_mday == 1 */ + tmg.tm_mday = 0; } + diff += 1440 * (tml.tm_mday - tmg.tm_mday); if (diff < 0) { |