Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
| From | James Kuyper <jameskuyper@verizon.net> |
|---|---|
| Newsgroups | comp.lang.c |
| Subject | Re: mktime |
| Date | 2012-12-06 09:53 -0500 |
| Organization | A noiseless patient Spider |
| Message-ID | <k9qbgr$ofj$1@dont-email.me> (permalink) |
| References | <87vccf1clw.fsf@huddi.jernurt.dk> |
On 12/06/2012 09:25 AM, Anders Wegge Keller wrote: > > According to the C2011 draft I have available, the values in the > struct tm, passed to mktime(), are not restricted to the normalized > ranges. (2.27.2.3 ยง2). > > Is this to be taken literally, such that any combination of values in > the tm struct, that corresponds to something that can be expressed in > a time_t is a valid input? Yes. This feature, allows performance of date arithmetic. For instance, take a struct tm that represents 2012-12-06 09:41, subtract 7 from tm_mday, and pass it to mktime(), which should normalize that struct to describe 2012-11-29 09:41. This is, in fact, the main thing I've ever used mktime() for. mktime() has to know how many days there are in each month, which years are leap years, what day of the week each date is; so it saves me from having to write all that logic in my own code. > As I read the following paragrahp, that seem to be the case. Which > lead me to think of exxtreme cases like tm_sec, tm_min, tm_hour, > tm_mday and tm_mon all at INT_MAX, and tm_year set to a sufficiently > large negative value. > > Am I missing something, or would a conforming implementation have to > handle this? Yes, it would. -- James Kuyper
Back to comp.lang.c | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
mktime Anders Wegge Keller <wegge@wegge.dk> - 2012-12-06 15:25 +0100
Re: mktime James Kuyper <jameskuyper@verizon.net> - 2012-12-06 09:53 -0500
Re: mktime Eric Sosman <esosman@comcast-dot-net.invalid> - 2012-12-06 10:11 -0500
Re: mktime Anders Wegge Keller <wegge@wegge.dk> - 2012-12-06 17:40 +0100
Re: mktime Eric Sosman <esosman@comcast-dot-net.invalid> - 2012-12-06 14:20 -0500
Re: mktime Keith Thompson <kst-u@mib.org> - 2012-12-06 12:28 -0800
Re: mktime Eric Sosman <esosman@comcast-dot-net.invalid> - 2012-12-06 17:36 -0500
Re: mktime Eric Sosman <esosman@comcast-dot-net.invalid> - 2012-12-06 17:42 -0500
Re: mktime Keith Thompson <kst-u@mib.org> - 2012-12-06 12:20 -0800
Re: mktime Anders Wegge Keller <wegge@wegge.dk> - 2012-12-06 21:37 +0100
Re: mktime "Heinrich Wolf" <invalid@invalid.invalid> - 2012-12-07 09:48 +0100
Re: mktime James Kuyper <jameskuyper@verizon.net> - 2012-12-07 08:08 -0500
Re: mktime "christian.bau" <christian.bau@cbau.wanadoo.co.uk> - 2012-12-07 09:23 -0800
Re: mktime James Kuyper <jameskuyper@verizon.net> - 2012-12-07 13:14 -0500
Re: mktime Eric Sosman <esosman@comcast-dot-net.invalid> - 2012-12-07 13:46 -0500
Re: mktime "Heinrich Wolf" <invalid@invalid.invalid> - 2012-12-07 19:59 +0100
Re: mktime Robert Wessel <robertwessel2@yahoo.com> - 2012-12-07 15:50 -0600
Re: mktime "Heinrich Wolf" <invalid@invalid.invalid> - 2012-12-07 21:39 +0100
Re: mktime Eric Sosman <esosman@comcast-dot-net.invalid> - 2012-12-07 17:17 -0500
Re: mktime Keith Thompson <kst-u@mib.org> - 2012-12-07 17:50 -0800
Re: mktime Eric Sosman <esosman@comcast-dot-net.invalid> - 2012-12-08 08:34 -0500
Re: mktime pacman@kosh.dhis.org (Alan Curry) - 2012-12-07 22:44 +0000
Re: mktime "Heinrich Wolf" <invalid@invalid.invalid> - 2012-12-08 10:31 +0100
Re: mktime pacman@kosh.dhis.org (Alan Curry) - 2012-12-08 20:50 +0000
Re: mktime "Heinrich Wolf" <invalid@invalid.invalid> - 2012-12-09 11:39 +0100
Re: mktime pacman@kosh.dhis.org (Alan Curry) - 2012-12-09 19:47 +0000
Re: mktime "Heinrich Wolf" <invalid@invalid.invalid> - 2012-12-10 09:51 +0100
Re: mktime sla29970@gmail.com - 2012-12-09 08:41 -0800
csiph-web