From b74a9a82bbc89c5b26f33126427912df2fa45960 Mon Sep 17 00:00:00 2001 From: Daniel Larimer Date: Tue, 17 Jun 2014 11:12:15 -0400 Subject: [PATCH] update display for delta time in future --- src/time.cpp | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/time.cpp b/src/time.cpp index 61eaca5..9151aa6 100644 --- a/src/time.cpp +++ b/src/time.cpp @@ -45,12 +45,14 @@ namespace fc { // inspired by show_date_relative() in git's date.c string get_approximate_relative_time_string(const time_point_sec& event_time, const time_point_sec& relative_to_time /* = fc::time_point::now() */, - const std::string& ago /* = " ago" */) { + const std::string& default_ago /* = " ago" */) { + + string ago = default_ago; if (event_time > relative_to_time) - return "in the future"; + ago = " in the future"; stringstream result; - uint32_t seconds_ago = relative_to_time.sec_since_epoch() - event_time.sec_since_epoch(); + uint32_t seconds_ago = abs(relative_to_time.sec_since_epoch() - event_time.sec_since_epoch()); if (seconds_ago < 90) { result << seconds_ago << " second" << (seconds_ago > 1 ? "s" : "") << ago;