[Lazarus] Portable way to get accurate timestamps?

ik idokan at gmail.com
Sun Feb 20 10:58:59 CET 2011


There is a known problem of windows vs linux with timestamps.
Windows for some reason is less accurate and change the clock every usage of
Windows, while in Linux it's considered more accurate. I'm saying it from a
bad experience so far.

Secondly. you always have to know where the clock is set for. that is
timezone etc... If it's UTC or timezone changes the way you should use the
timestamp then a local one, unless you are interested in the local time
only.



On Sun, Feb 20, 2011 at 11:47, Bo Berglund <bo.berglund at gmail.com> wrote:

> In my data acquisition program I also need to timestamp the retrieved
> data from the instrument. I want this to be as accurate as possible
> and also portable Windows->Linux->Embedded Linux
>
> In Delphi/FPC there are two ways to get a time value that I know of:
>
> GetTickCount gives a value that is in millisecond resolution, but I
> don't know how accurate it actually is on the various platforms.
>
> Now() retrieves a TDateTime value, but again I don't know how accurate
> it is. Resolution-wise since it is a double it should suffice since it
> is based on the year 1900 and we have about 40500 days since then and
> thus about 3.500.000.000 seconds. So the double resolution should get
> a bit into the decimals of a second. But how many accurate decimals
> can be expected? Can I reach millisecond accuracy?
>
> If so, which would be the better way?
>
>
> --
> Bo Berglund
> Developer in Sweden
>
>
> --
> _______________________________________________
> Lazarus mailing list
> Lazarus at lists.lazarus.freepascal.org
> http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
>


Ido
LINESIP - Opening the source for communication
http://www.linesip.com
http://www.linesip.co.il
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.lazarus-ide.org/pipermail/lazarus/attachments/20110220/ff049146/attachment-0003.html>


More information about the Lazarus mailing list