mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
core: add functions to core/time.c
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>
This commit is contained in:
parent
efdc875aa3
commit
0f4154bacc
2 changed files with 32 additions and 0 deletions
|
|
@ -11,6 +11,8 @@ extern "C" {
|
|||
|
||||
extern timestamp_t utc_mktime(struct tm *tm);
|
||||
extern void utc_mkdate(timestamp_t, struct tm *tm);
|
||||
extern int utc_year(timestamp_t timestamp);
|
||||
extern int utc_weekday(timestamp_t timestamp);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue