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-07 13:14 -0500 |
| Organization | A noiseless patient Spider |
| Message-ID | <50C23210.70202@verizon.net> (permalink) |
| References | (1 earlier) <k9qcil$oh$1@dont-email.me> <lnobi7ortk.fsf@nuthaus.mib.org> <k9saf7$jn$1@news.m-online.net> <k9spov$8cb$2@dont-email.me> <325d43da-95b8-4413-a691-bfaea9a8f68c@f8g2000yqa.googlegroups.com> |
On 12/07/2012 12:23 PM, christian.bau wrote:
> Question: If you start with 28th February 2012, then adding one year,
> followed by adding two days, will get you 28th Feb 2013, then 2nd Mar
> 2013. But adding two days, followed by adding one year, will get you
> 1st Mar 2012, followed by 1st Mar 2013. Not the same.
>
> Are there rules for this kind of thing? Is it unspecified or
> undefined?
>
> What's supposed to happen if you add one month to March 31st 2012? The
> result can't be April 31st; is it April 30th, May 1st, or something
> else?
No, the rules for such things aren't specified, and that lack of
specification is a problem.
given:
#include <time.h>
// Two different ways to describe 2012-03-31:
struct tm a = {.tm_year=2012-1900, .tm_month = 3-1, .tm_day = 31};
struct tm b = {.tm_year=2012-1900, .tm_month = 4-1, .tm_day = 0};
a.tm_month += 1;
mktime(&a);
b.tm_month += 1;
mktime(&b);
My preference would be that this point, 'a' represents 2012-05-01, while
'b' represents 2012-04-30. But the standard doesn't address such questions.
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