diff options
author | Karen Arutyunov <karen@codesynthesis.com> | 2020-03-30 20:47:38 +0300 |
---|---|---|
committer | Karen Arutyunov <karen@codesynthesis.com> | 2020-04-01 13:10:06 +0300 |
commit | 0598a6d315ecadc5dd58cd8f5dde7c603c3f493c (patch) | |
tree | fa24de8d71bb6501d889956878666674d44adda7 /libbutl/timestamp.mxx | |
parent | 34466f10506fd57836e89cffda7738c3008321b1 (diff) |
Add daytime() function
Diffstat (limited to 'libbutl/timestamp.mxx')
-rw-r--r-- | libbutl/timestamp.mxx | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/libbutl/timestamp.mxx b/libbutl/timestamp.mxx index f4a06f9..9525ec0 100644 --- a/libbutl/timestamp.mxx +++ b/libbutl/timestamp.mxx @@ -194,4 +194,14 @@ LIBBUTL_MODEXPORT namespace butl const char* format, bool local, const char** end = nullptr); + + // Rebase a time point from UNIX epoch to midnight in the local time zone + // (so the returned duration is always less than 24 hours). + // + // Specifically, convert the time point from Epoch to the local time and + // return the time elapsed since midnight. Throw std::system_error on + // underlying time conversion function failures. + // + LIBBUTL_SYMEXPORT duration + daytime (timestamp); } |