Re: Number of Years



"Richard G. Riley" <rgrdev@xxxxxxxxx> writes:
On 2006-03-12, Keith Thompson <kst-u@xxxxxxx> wrote:
"Richard G. Riley" <rgrdev@xxxxxxxxx> writes:
[...]
There you have all your discrete time elements at your beck and
call. I cant vouch for platform independance though. In my debugger I
see:

$3 = {tm_sec = 17, tm_min = 23, tm_hour = 17, tm_mday = 12, tm_mon = 2,
tm_year = 106, tm_wday = 0, tm_yday = 70, tm_isdst = 0, tm_gmtoff = 3600,
tm_zone = 0x804a040 "CET"}

Better yet, look at the actual specification of the "struct tm"
type.

Interesting point : the dump was more to show the "human readable
numbers", but I'm not so impressed with the man page definition
disagreeing with the compile time structure definition. Not that it
makes one iota of differenc for the problem in hand : possibly more
important in std.c.

What are you unimpressed about? The standard specifically says that
an implementation is allowed to add extra members. I don't know what
the man page says; it could follow either the standard or the
system-specific definition (if it does the latter, it should
acknowledge that two of the fields are implementation-defined.

Reading n1124 (or some other draft of the standard) would have avoided
this confusion.

But you would agree this is a tidier way of solving this problem?

If by "this" you mean using a debugger, no. If you mean using
localtime() rather than doing arithmetic on time_t values, I've
already addressed that point in this thread.

--
Keith Thompson (The_Other_Keith) kst-u@xxxxxxx <http://www.ghoti.net/~kst>
San Diego Supercomputer Center <*> <http://users.sdsc.edu/~kst>
We must do something. This is something. Therefore, we must do this.
.



Relevant Pages

  • Re: Number of Years
    ... look at the actual specification of the "struct tm" ... Reading n1124 (or some other draft of the standard) would have avoided ... If by "this" you mean using a debugger, ... Whyt would I be referring to using a debugger? ...
    (comp.lang.c)
  • Re: Number of Years
    ... an implementation is allowed to add extra members. ... only if* it makes it clear that they're not standard, ... I also mentioned that I couldnt state platform independance. ... If by "this" you mean using a debugger, ...
    (comp.lang.c)
  • Re: strict aliasing rules in ISO C, someone understands them ?
    ... > I try to understand strict aliasing rules that are in the C Standard. ... > Let's have two struct having different tag names, ... > struct s1 {int i;}; ... Accessing a member of the foreign structure type through the pointer ...
    (comp.lang.c)
  • Re: Yet another binary search tree library
    ... Some information in this wikipedia page is wrong. ... if there is undefined behavior or not (not counting ... As far as the Standard is concerned, ... kind of struct by means of member access (ie, ...
    (comp.lang.c)
  • Re: Why is C Standard Code Example Invalid?
    ... JK> that a declaration of the complete type of the union is ... the safest bet is to take the standard at it's ... struct t1; ... "E.MOS", which would suggest that the implicit dereference occurs, but ...
    (comp.std.c)