Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
| Path | csiph.com!eternal-september.org!feeder.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail |
|---|---|
| From | Keith Thompson <kst-u@mib.org> |
| Newsgroups | comp.lang.c |
| Subject | Re: time functions weirdness |
| Date | Sat, 17 Sep 2016 17:04:02 -0700 |
| Organization | None to speak of |
| Lines | 24 |
| Message-ID | <lny42qxedp.fsf@kst-u.example.com> (permalink) |
| References | <e45d70Fk5lU1@mid.individual.net> |
| Mime-Version | 1.0 |
| Content-Type | text/plain; charset=us-ascii |
| Injection-Info | mx02.eternal-september.org; posting-host="945944de09706c9b4e29b53c9d2efdc2"; logging-data="15983"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX18cReID+LII0lZv8YMwOM2O" |
| User-Agent | Gnus/5.13 (Gnus v5.13) Emacs/23.1 (gnu/linux) |
| Cancel-Lock | sha1:Dz+D2tQtQvQAU32kP6Navx7LJ2Q= sha1:6JRdZNRZ0/m+1iwqwyjzsVdV30U= |
| Xref | csiph.com comp.lang.c:93700 |
Show key headers only | View raw
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