aboutsummaryrefslogtreecommitdiffstats
path: root/core/subsurface-time.h
AgeCommit message (Collapse)Author
2020-12-29cleanup: const-ify utc_mktime()Gravatar Berthold Stoeger
To make it clear that the struct tm is only used as an input parameter. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2020-12-29cleanup: move monthname to time.cGravatar Berthold Stoeger
Weirdly, this function was declared in dive.h and defined in subsurface-startup.c. Let's move declaration and definition to more appropriate places, viz. subsurface-time.h and time.c. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2020-09-29core: add helper functions to format / parse timestampsGravatar Berthold Stoeger
To save datetime-based filter constraints to git or XML, it is preferrable to use human-readable representations. Therefore, add helper functions to format / parse timestamp_t 64-bit values in the "YYYY-MM-DD hh:mm:ss" format. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2020-09-29core: add functions to core/time.cGravatar Berthold Stoeger
To support the new filter code, add helper functions that turn timestamps into year and day-of-week to core/time.c. Internally, these functions simply call utc_mktime() to break down the timestamp and then extract the wanted value. This may appear inefficient, but testing shows that modern compilers are quite effective in throwing away the unneeded calculations. FWIW in this respect clang10 outperformed gcc10. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2020-05-01cleanup: move declaration of utc_mk* functions to new subsurface-time.h headerGravatar Berthold Stoeger
No point in slurping in all of dive.h for translation units that only want to do some time manipulation without ever touching a dive. Don't call the header "time.h", because we don't want to end up in a confusion with the system header of the same name. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>