# `NervesTime.FileTime`
[🔗](https://github.com/nerves-time/nerves_time/blob/v0.4.12/lib/nerves_time/file_time.ex#L6)

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.

# `get_time`

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

# `set_time`

Update the file holding a stamp of the current time.

# `terminate`

Update the timestamp one final time

# `time_file`

```elixir
@spec time_file() :: Path.t()
```

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

---

*Consult [api-reference.md](api-reference.md) for complete listing*
