Hi,

On Fri, Aug 12, 2016 at 09:53:34PM +0200, David Woodhouse wrote:
> On Thu, 2016-08-11 at 21:23 +0200, Gert Doering wrote:
> > All our timestams used to be "what ctime()" produces, which is
> > 
> >   "Thu Aug 11 21:15:27 2016"
> > 
> > Changed to use POSIX standard format, which is
> > 
> >   "2016-08-11 21:15:27"
> 
> While you're at it, perhaps also add the timezone in numeric (±0000)
> format. It is often the case that servers logging in their own random
> localtime make it difficult to correlate logs from hosts in different
> parts of the world. The general rule of thumb is that a time without a
> zone is meaningless.

This is a good argument.  Unfortunately, it's a surprisingly *hairy* one,
as there are time zones that do not have a full-hour offset - so ISO 8601
(according to wikipedia) says you should do "±hh:mm" then - and for
most folks, ":mm" would always be ":00", sort of waste of screen real
estate...

Regarding portability, this is even more interesting.  I assumed that
localtime()'s "struct tm" would be truly portable, but it seems that
older unixes have "long    tm_tzadj; /* seconds from UTC */" while
modern ones have "long tm_gmtoff; /* offset from UTC in seconds */"
(WHY OH WHY???)....

 * TZMINS_USE_xxxxxx specifies how to get timezone offset.
 *
 *      TZMINS_USE_TM_TZADJ    use (struct tm*)->tm_tzadj
 *      TZMINS_USE_TM_GMTOFF   use (struct tm*)->tm_gmtoff
 *      TZMINS_USE_TZAZ_GLOBAL use "timezone, altzone" externals
 *      TZMINS_USE_TZ_GLOBAL   use "timezone" external
 *      TZMINS_USE_FTIME       use ftime() function
 *      TZMINS_USE_TIMEOFDAY   use gettimeofday() function

... from ports/elm/lib/get_tz.c...

(I don't think anything but tzadj/gmtoff is relevant anymore today, but
need to check more systems.  And no, strftime() isn't helping - it
has "%z", which, according to FreeBSD's man page is an extention to
the C90 standard...)


I think I can see why James just used ctime() here :-)

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