From 0598a6d315ecadc5dd58cd8f5dde7c603c3f493c Mon Sep 17 00:00:00 2001 From: Karen Arutyunov Date: Mon, 30 Mar 2020 20:47:38 +0300 Subject: Add daytime() function --- libbutl/timestamp.mxx | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'libbutl/timestamp.mxx') 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); } -- cgit v1.1