[freetds] FreeTDS returned data lenght????

Michael Peppler mpeppler at peppler.org
Wed Oct 15 16:41:22 EDT 2003


On Wed, 2003-10-15 at 15:34, Ole Hansen wrote:
> Hi,
> 
> Sorry for the interruption :)
> I an application I do the following when calculating the time as I want
> the time to be represented as UNIX-time used in my application:
> 
> DATETIME:
> -------------
> double time;
> u_int32_t days = *((u_int32_t *)value);
> u_int32_t msec = *((u_int32_t *)(value+sizeof(u_int32_t)));
> time = ((double)(days-25567))*24*60*60 + ((double)msec)/1000.0;
>  
> The day calculated gives me the expected day but the usec doesnt match.
> This is for CS_DATETIME_TYPE. The calculated value is 8-10 hours behind.

the "msec" value is really 300th of a seconds, not 1000th.

Michael
-- 
Michael Peppler                              Data Migrations, Inc.
mpeppler at peppler.org                 http://www.mbay.net/~mpeppler
Sybase T-SQL/OpenClient/OpenServer/C/Perl developer available for short or 
long term contract positions - http://www.mbay.net/~mpeppler/resume.html


More information about the FreeTDS mailing list