[Ovmsdev] Time units and functions

Michael Geddes frog at bunyip.wheelycreek.net
Fri Oct 20 13:02:01 HKT 2023


Hi all,

firstly, it seems we are using a bunch of time functions that are not
thread-safe  (localtime gmtime and asctime)  (See recommendation here:
https://docs.espressif.com/projects/esp-idf/en/latest/esp32/api-reference/system/system_time.html)
- so I'll push up a p/r for that.


Next is the couple of Metrics that are using the unit 'Seconds' but which
are really time_t values..
I'm looking to add a new Group of metrics for time with units UnixEpoch,
UTCDate & LocalDate.
This is what I have  at the moment with the default metrics for m.time.utc
as UTCDate and v.p.gpstime as LocalDate.   (I can make them the same)

m.time.utc                               2023-10-19 11:22:28 UTC
v.p.gpstime                              2023-10-19 19:22:26 AWST

Currently I've changed these in the JSON to be exported as "%FT%T.000Z"
which is a semi standard for JSON.

The 'conversion' for the date values doesn't do anything - these really
only effect the output.

I've also been looking at v.g.timerstart which is UTCTime & LocalTime
units.  I've fixed up conversions both way..
v.g.timerstart                           18:00:00local

Thoughts on these? Cautions?

//.ichael
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openvehicles.com/pipermail/ovmsdev/attachments/20231020/94fb03b4/attachment.htm>


More information about the OvmsDev mailing list