monit-general
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: time offsets


From: Christian Hopp
Subject: Re: time offsets
Date: Wed, 14 Aug 2002 12:39:19 +0200 (CEST)

On 13 Aug 2002, Rory Toma wrote:

>
> I'll check it in after I test on Solaris and get my FreeBSD working.

Ooops... )-: tm_gmtoff is a BSD feature.  Linux has it only if
__USE_BSD is defined otherwise it's private.  Solaris 7/8 doesn't even
have it and doesn't compile for me.

Can you do a...

---SNIP---
  tm_now = localtime(&now);

#ifdef FREEBSD
  timezone_h = -(tm_now->tm_gmtoff/3600);
  timezone_m = abs(tm_now->tm_gmtoff/60)%60;
#else
  timezone_h = -(timezone/3600);
  timezone_m = abs(timezone/60)%60;
#endif

  datelen=strftime(D, STRLEN-7, "%a, %d %b %Y %H:%M:%S", tm_now);
---SNAP---

... instead?

Sorry, it looked so portable because it came from struct tm. )-:


> On Tue, 2002-08-13 at 15:19, Jan-Henrik Haukeland wrote:
> > Rory Toma <address@hidden> writes:
> >
> > > In util.c I noticed that following code:
> > >
> > > <   timezone_h= -(timezone/3600)+daylight;
> > > <   timezone_m= abs(timezone/60)%60;
> > >
> > > Now, this wouldn't compile out of the box on FreeBSD, so I looked at
> > > some man pages.
> > >
> > > Isn't something like:
> > >
> > > >   tm_now = localtime(&now);
> > > >
> > > >   timezone_h = -(tm_now->tm_gmtoff/3600);
> > > >   timezone_m = abs(tm_now->tm_gmtoff/60)%60;
> > >
> > > more portable?
> >
> > Please check it into cvs then if it works
> >
> > --
> > Jan-Henrik Haukeland
> >
> >
> > --
> > To unsubscribe:
> > http://mail.freesoftware.fsf.org/mailman/listinfo/monit-general
> >
>

-- 
Christian Hopp                                email: address@hidden
Institut für Elektrische Informationstechnik             fon: +49-5323-72-2113
Technische Universität Clausthal                         fax: +49-5323-72-3197
  pgpkey: https://www.iei.tu-clausthal.de/pgp-keys/chopp.key.asc  (2001-11-22)





reply via email to

[Prev in Thread] Current Thread [Next in Thread]