help-gplusplus
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Time handling


From: Ulrich Lauther
Subject: Re: Time handling
Date: Sat, 14 Aug 2004 19:09:26 +0000 (UTC)

Dave Parker <invalid@null.com> wrote:
: I need some pointers to handling/converting time
: values.  I'm reading a file from a legacy DOS
: application that uses a time_t type.  This is a
: typedef for a long.  I understand that this is the
: number of seconds since midnight, January 1, 1970.

: I would like to convert it to a double - the integer
: part which is the number of days that have passed
: since 12/30/1899, and the fractional part is the fraction
: of the 24 hour day that has elapsed. (This is the Delphi
: format, and maybe the format for other languages and
: systems.  But I'll doing the conversion in C/C++).

seems simple:

double delphi_time = (dos_time + OFFSET)/(24*3600);

with OFFSET = time in seconds between 12/30/1899 and 1/1/1970.

-- 
        -lauther

[nosave]
----------------------------------------------------------------------------
Ulrich Lauther          ph: +49 89 636 48834 fx: ... 636 42284
Siemens CT SE 6         Internet: Ulrich.Lauther@siemens.com


reply via email to

[Prev in Thread] Current Thread [Next in Thread]