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

Re: [Minios-devel] [PATCH] mini-os: Fix date issue in gettimeofday function



Hello,

David Vercauteren, on Wed 06 Apr 2016 16:49:25 +0200, wrote:
> If an application makes use of the monotonic clock function before
> the wallclock is updated (timer_handler function was not yet called),
> the struct shadow_ts_version will not contain the correct value.
> As a result the application will not display the correct date.

Mmm, it's not the monotonic clock which poses problem, but reading
shadow_ts.tv_nsec. I'd rather put that update_wallclock() inside
gettimeofday since that's the only user of shadow_ts.

Also, thinking again about this time computation, it seems odd to
me that they are updated from the interrupt handler: what about
when an interrupt happens in the middle of the gettimeofday() or
monotonic_clock() call? Reads from shadow and shadow_ts don't seem safe
to me.

In the end, I'm tempted to do the attached changes (not tested yet)

Last but not least, I'm surprised by what gettimeofday does: it adds
system_time to (time since boot) to wc_sec (wallclock time), it looks to
me like this ends up with time going two times faster!

I have to leave for a concert, just leaving these notes here for now
in case somebody determines how this system_time / wc_sec thing is
supposed to work, in the meanwhile

Samuel

Attachment: patch
Description: Text document

_______________________________________________
Minios-devel mailing list
Minios-devel@xxxxxxxxxxxxxxxxxxxx
http://lists.xenproject.org/cgi-bin/mailman/listinfo/minios-devel

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.