[cvsnt] cvsnt B2151+ - storing 'localtime' in the sessionLog database table

Tony Hoyle tony.hoyle at march-hare.local
Sat Nov 18 16:09:51 GMT 2006

Joe Enfield wrote:
> I've noticed that cvsnt converts the time from UTC to localtime before 
> persisting to the database.
> strftime(dt,sizeof(dt),"%Y-%m-%d %H:%M:%S",localtime(&d));

Actually it's the other way around.  get_date is an odd function - it 
expects a string in local time & returns a time_t in UTC.  Because in 
this case it's being passed a UTC string from the server, it returns a 
time_t offset by negative localtime, then when you call localtime you 
get UTC back.

> Using MS SqlServer this has the affect of showing the time in UTC when using 
> clients to view the database table - as long as the Locale of the viewer is 

..which shows it's working OK.


More information about the cvsnt mailing list