[Sugar-devel] Best time format for logging?
Manuel Quiñones
manuq at laptop.org
Sat Mar 1 12:20:37 EST 2014
2014-02-28 20:30 GMT-03:00 James Cameron <quozl at laptop.org>:
> On Fri, Feb 28, 2014 at 02:39:41PM -0300, Manuel Quiñones wrote:
>> date +%s.%N
>> 1393609027.074597846
>
> Yes, this is adequate, though sometimes the fractional value can be
> imprecise as it depends on many factors.
>
> For response times, it is useful, but care should be taken to record
> the value in the most primitive form and do the conversion to text
> some other time, otherwise the measurement can affect the result.
>
> For the case in olpc-utils you change in your patch, use the %s format
> character. You don't need higher resolution for that use case.
>
> The epoch time is the most useful, as it is independent of time zone
> configuration on the system.
>
> In the case of your code, you can optimise it to avoid creating a
> process to exec /bin/date, by using printf in bash:
>
> printf 'START_SUGAR %(%s)T\n' -1 >> $HOME/.olpc-launch-stats
>
> If you use -2 instead of -1, you will get the time the olpc-session
> process started, rather than the current time.
Oh, I see, great!
Thanks for the valuable information, James.
--
.. manuq ..
More information about the Sugar-devel
mailing list