[Top][All Lists]

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

[Demexp-dev] Which timestamp at each modification?

From: David MENTRE
Subject: [Demexp-dev] Which timestamp at each modification?
Date: Tue, 07 Jun 2005 21:54:09 +0200
User-agent: Gnus/5.1006 (Gnus v5.10.6) Emacs/21.4 (gnu/linux)


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?


val time : unit -> float

 Return the current time since 00:00:00 GMT, Jan. 1, 1970, in seconds.

val gettimeofday : unit -> float

 Same as Unix.time, but with resolution better than 1 second.
pub  1024D/A3AD7A2A 2004-10-03 David MENTRE <address@hidden>
 5996 CC46 4612 9CA4 3562  D7AC 6C67 9E96 A3AD 7A2A

reply via email to

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