nerves_time v0.4.0 NervesTime.FileTime View Source

FileTime simulates a real-time clock using a file's mtime

The way it works is that a file is touched each time nerves_time wants to update the RTC. When nerves_time shuts down, the file is again touched. The next boot then reads the last modified time of the file so that nerves_time can set the clock to that value. It will certainly be off, but not absurdly so unless the device has been powered off for a really long time.

While this doesn't sound ideal at all, knowing the time within minutes, hours, or days can get the clock to within time ranges needed for X.509 certificate validation.

Link to this section Summary

Functions

Return the timestamp of when update was last called or the Unix epoch time (1970-01-01) should that not work.

Update the file holding a stamp of the current time.

Update the timestamp one final time

Return the path to the file that keeps track of the time

Link to this section Functions

Return the timestamp of when update was last called or the Unix epoch time (1970-01-01) should that not work.

Link to this function

set_time(path, naive_date_time)

View Source

Update the file holding a stamp of the current time.

Update the timestamp one final time

Link to this function

time_file()

View Source
time_file() :: Path.t()

Return the path to the file that keeps track of the time