Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mapsme/omim.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYuri Gorshenin <y@maps.me>2017-06-21 17:29:17 +0300
committerYuri Gorshenin <mipt.vi002@gmail.com>2017-07-05 16:41:38 +0300
commit01dd3625451f70d6f3c81a202fc9db4e02d236d8 (patch)
tree68298ed841df3197075ad86f88c336e58cbf6016 /ugc/types.hpp
parent7a57513d08adc9f91c221ca10df243e58377c0fb (diff)
[ugc] DaysAgo.
Diffstat (limited to 'ugc/types.hpp')
-rw-r--r--ugc/types.hpp8
1 files changed, 8 insertions, 0 deletions
diff --git a/ugc/types.hpp b/ugc/types.hpp
index 4c57f6ec52..343f6d82c7 100644
--- a/ugc/types.hpp
+++ b/ugc/types.hpp
@@ -56,6 +56,14 @@ inline Time FromDaysSinceEpoch(uint32_t days)
return Time(hours);
}
+inline uint32_t DaysAgo(Time const & time)
+{
+ auto const now = std::chrono::system_clock::now();
+ if (now < time)
+ return 0;
+ return std::chrono::duration_cast<std::chrono::hours>(now - time).count() / 24;
+}
+
struct RatingRecord
{
RatingRecord() = default;