Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to reset Ada.Real_Time.Clock?

when reading Ada.Real_Time.Clock right after power-up it shows a value that isn't close to zero and sometimes even negative. As far as I know Ada.Real_Time.Clock suppose to reset on power-up. How can I reset Ada.Real_Time.Clock?

Thanks.

like image 765
Yony Avatar asked Sep 20 '10 18:09

Yony


1 Answers

The Ada 2005 LRM declares that "real time is defined to be the physical time as observed in the external environment. [emphasis added--MC]

"It is not specified by the language whether the time values are synchronized with any standard time reference. For example, E can correspond to the time of system initialization or it can correspond to the epoch of some time standard." (D.8[18-19])

As it states, Ada does not require that "E", the start of the epoch serving as the "zero time" for real-time Time values, correspond to any particular starting point; it's left up to the compiler implementer.

Whatever specific numeric values you observe for the instances of Time you're seeing, whether near or far from zero, positive or negative, are dependent solely on the compiler implementer's choice of E, how it represents times values, and how it correspondingly implements the real-time capability.

Therefore you should avoid writing code that depends on specific, knowable values of Time, nor code that requires Time values to be intimately manipulable.

Real_Time.Time values should be considered abstract quantities.

like image 167
Marc C Avatar answered Oct 03 '22 23:10

Marc C