[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


Community technical support mailing list was retired 2010 and replaced with a professional technical support team. For assistance please contact: Pre-sales Technical support via email to sales@march-hare.com.


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.

Tony


More information about the cvsnt mailing list
Download the latest CVSNT, TortosieCVS, WinCVS etc. for Windows 8 etc.
@CVSNT on Twitter   CVSNT on Facebook