Hi,

On Fri, Aug 12, 2016 at 11:39:22PM +0200, David Woodhouse wrote:
> Yeah, I once made git use strftime("%z") but that is... handled
> differently now.
> 
>         time(&now);
> 
>         offset = tm_to_time_t(localtime(&now)) - now;
>         offset /= 60;
> 
> Where tm_to_time_t() is basically mktime() except that *that* has
> bizarre issues on some platforms too. But fundamentally, comparing
> gmtime(now) with localtime(now) might be the way to go.

After having looked at "man localtime" and "man strftime" on a few
platforms we support, I conclude that tm_adjtime and tm_gmtoffs are
both out (not on Solaris and AIX) and "%z" as well (not on AIX).  Meh.

Can you remember what the "bizarre issues" in mktime() are, and on
which platforms?  That would be a halfway compact way to find the 
offset, while reimplementing the "comparing gmtime to localtime" bit
(and repeating all possible errors that people have made there in the
past) is not something I'm looking forward to...

> The alternative option is just to *always* log in UTC, of course... :)

Dunno about others, but I *like* local time in timestamps - it helps my
brain put things together, and for some reason, my brain works in local
time...

(And yes, it would be much easier indeed... "just log seconds since the
Epoch in UTC!" - good enough for log correlation, bad for silly humans :-) )

gert

-- 
USENET is *not* the non-clickable part of WWW!
                                                           //www.muc.de/~gert/
Gert Doering - Munich, Germany                             g...@greenie.muc.de
fax: +49-89-35655025                        g...@net.informatik.tu-muenchen.de

Attachment: signature.asc
Description: PGP signature

------------------------------------------------------------------------------
What NetFlow Analyzer can do for you? Monitors network bandwidth and traffic
patterns at an interface-level. Reveals which users, apps, and protocols are 
consuming the most bandwidth. Provides multi-vendor support for NetFlow, 
J-Flow, sFlow and other flows. Make informed decisions using capacity 
planning reports. http://sdm.link/zohodev2dev
_______________________________________________
Openvpn-devel mailing list
Openvpn-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/openvpn-devel

Reply via email to