[BRLTTY] gettimeofday
Vladimir 'φ-coder/phcoder' Serbinenko
phcoder at gmail.com
Mon Jun 18 12:03:10 EDT 2012
On 18.06.2012 15:20, Dave Mielke wrote:
> [quoted lines by Vladimir 'φ-coder/phcoder' Serbinenko on 2012/06/18 at 14:39 +0200]
>
>> Previously it was discussed how to make an equivalent of gettimeofday to
>> work on GRUB.
>
> Yes. You may wish to check timing:getCurrentTime() to see if we got it right
> for grub.
>
I'll look into it.
>> Now, I've realized that the current code using gettimeofday is wrong since the
>> date gives no guaranty of being monotonic, and especially it isn't if someone
>> runs "date" or "ntpdate" which is common operation, especially on systems
>> where the RTC battery is failing.
>
> And during daylight saving time switches. :-)
>
Unless you use UTC.
>> brltty should use time/gettimeofday only for timestamping logs and
>> CLOCK_MONOTONIC (probably with some wrapper to make other monotonic clock
>> sources easy to add) for all timing and timeout purposes.
>
> Yes, thanks, for timeouts that's an excellent point. I doubt CLOCK_MONOTONIC
> existed way back whenever, but, yes, we really should fix this. We can always
> code the current method as a fallback for builds on old systems.
>
> What should we be using within the Grub environment for this?
grub_get_time_ms. On modern X86 it's based on TSC.
>
--
Regards
Vladimir 'φ-coder/phcoder' Serbinenko
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 294 bytes
Desc: OpenPGP digital signature
URL: <http://mielke.cc/pipermail/brltty/attachments/20120618/ad71ca8f/attachment.sig>
More information about the BRLTTY
mailing list