Re: tm_gmtoff



On 01/30/09 05:14 pm, John Small wrote:
I am trying to port software which references tm_gmtoff as a member of
"struct tm".

However, I am using Paul Semdley's build evnironment and my time.h
has:
#if 0 /* bird: LIBC isn't implementing tm_gmtoff and tm_zone. */
long tm_gmtoff; /* offset from UTC in seconds */
char *tm_zone; /* timezone abbreviation */
#endif

This, of course, results in compilation errors.

Would it be appropriate to use:
tzset();
m_time -= timezone;
in place of:
if ((tm = localtime(&m_time)) != (struct tm *)NULL)
m_time -= tm->tm_gmtoff; /* sec. EAST of GMT:
subtr. */

Or is there a better solution?


This looks like the correct solution. Just beware that tzset() is picky about the value of %TZ%. See the emx 0.9d C library reference
Dave
.



Relevant Pages

  • Re: tm_gmtoff
    ... I am using Paul Semdley's build evnironment and my time.h ... This, of course, results in compilation errors. ...
    (comp.os.os2.programmer.porting)
  • Re: Fix collie compilation
    ... The correct solution is to ... However, the patch doesn't apply to any -rc1 kernel, so it's been dropped ... It would be nice to get patches generated against mainline kernels, ...
    (Linux-Kernel)
  • Re: Total Combinations Matching a Set Sum
    ... Einar Andreas Rødland wrote: ... > does this in integer arithmetic and that getting the correct solution ... Paul ... Prev by Date: ...
    (sci.stat.math)
  • Re: multiple macro defns
    ... only correct solution for my problem. ... #ifdef my_feat ... #ifndef my_feat ...
    (comp.lang.c)
  • Re: Fix collie compilation
    ... I'm fine with the defconfig changes but this last bit doesn't fix the ... original problem if CONFIG_PCMCIA_SA1100=m. ... The correct solution is to ...
    (Linux-Kernel)