Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
| From | Keith Thompson <kst-u@mib.org> |
|---|---|
| Newsgroups | comp.lang.c |
| Subject | Re: time functions weirdness |
| Date | 2016-09-17 17:04 -0700 |
| Organization | None to speak of |
| Message-ID | <lny42qxedp.fsf@kst-u.example.com> (permalink) |
| References | <e45d70Fk5lU1@mid.individual.net> |
Robert Latest <boblatest@yahoo.com> writes:
> the task is simple: Convert a time string to a time_t and back. I'm not even
> concerned with timezones, I want everything to be in UTC. But for some
> reason it just doesn't work and I don't know why. Is it possible that
> mktime()'s and gmtime()'s notions of the UNIX epoch differ by one hour?
[...]
localtime() converts a time_t value to a struct tm value representing
a local time. gmtime() converts a time_t value to a struct tm
value representing a UTC time.
mktime() is essentially the inverse of localtime(); it converts
a struct tm value representing a local time to a time_t value.
There is no inverse of the gmtime() function.
This is IMHO quite unfortunate, and I don't know why something like a
mktime_utc() function (perhaps with a better name) was never added
to the standard.
--
Keith Thompson (The_Other_Keith) kst-u@mib.org <http://www.ghoti.net/~kst>
Working, but not speaking, for JetHead Development, Inc.
"We must do something. This is something. Therefore, we must do this."
-- Antony Jay and Jonathan Lynn, "Yes Minister"
Back to comp.lang.c | Previous | Next — Previous in thread | Find similar | Unroll thread
time functions weirdness Robert Latest <boblatest@yahoo.com> - 2016-09-17 17:35 +0000
Re: time functions weirdness Robert Latest <boblatest@yahoo.com> - 2016-09-17 17:38 +0000
Re: time functions weirdness "James R. Kuyper" <jameskuyper@verizon.net> - 2016-09-17 14:26 -0400
Re: time functions weirdness Robert Latest <boblatest@yahoo.com> - 2016-09-17 20:26 +0000
Re: time functions weirdness "James R. Kuyper" <jameskuyper@verizon.net> - 2016-09-17 17:21 -0400
Re: time functions weirdness Keith Thompson <kst-u@mib.org> - 2016-09-17 16:54 -0700
Re: time functions weirdness "James R. Kuyper" <jameskuyper@verizon.net> - 2016-09-17 18:00 -0400
Re: time functions weirdness Ian Collins <ian-news@hotmail.com> - 2016-09-18 10:45 +1200
Re: time functions weirdness Keith Thompson <kst-u@mib.org> - 2016-09-17 17:24 -0700
Re: time functions weirdness Robert Latest <boblatest@yahoo.com> - 2016-09-18 06:25 +0000
Re: time functions weirdness Ben Bacarisse <ben.usenet@bsb.me.uk> - 2016-09-18 20:40 +0100
Re: time functions weirdness supercat@casperkitty.com - 2016-09-18 16:00 -0700
Re: time functions weirdness Keith Thompson <kst-u@mib.org> - 2016-09-17 17:04 -0700
csiph-web