--- Begin Message ---
Subject: |
Re: [Demexp-dev] Which timestamp at each modification? |
Date: |
Tue, 07 Jun 2005 22:35:32 +0200 |
User-agent: |
Mozilla Thunderbird 1.0.2 (X11/20050331) |
David MENTRE a écrit :
>Hello,
>
>For the caching mechanism, I will need to store a timestamp each time a
>question is modified on the server. This timestamp is communicated to
>the client, that uses it internally to determine if something has
>changed since last time it connected.
>
>I'm thinking of three way to store and communicate this timestamp:
>
> 1. as a date in an ASCII string, e.g. 2005-06-07T12:00;
>
> 2. as a 32 or 64 bits integer, incremented each time something is
> modified, e.g. 165778, 165779, 165780;
>
> 3. as a float storing time since 00:00:00 GMT, Jan. 1, 1970, in
> seconds, as given by OCaml's gettimeofday[1].
>
>Solution 1 seems overcomplicated to me. Solution 2 is quite efficient to
>handle in CPU and size (on both the server and client side) but solution
>3 provides the advantage to give an absolute time of last modification
>that might be useful later. The main issue against solution 3 is that
>comparison of floating point numbers is unprecise and vary from
>processor to processor (i.e. strange bug might occur).
>
>Any advice? Any other scheme I might have missed?
>
>
Why not storing the number of seconds since 01/01/1970
as an integer? If 2 events happen within the same second, it
is not a problem because this number is just used to
inform about the last "date" when an event occured. Higher
resolution than the second is not really useful.
Hope it hepls,
Félix
--- End Message ---