krb5 commit: KfW GUI -- abbreviate durations

Benjamin Kaduk kaduk at MIT.EDU
Mon Aug 27 11:52:17 EDT 2012


https://github.com/krb5/krb5/commit/d3bad500077b597b28864abdbe003dbb99ffcc90
commit d3bad500077b597b28864abdbe003dbb99ffcc90
Author: Kevin Wasserman <kevin.wasserman at painless-security.com>
Date:   Wed Jun 27 21:46:04 2012 -0400

    KfW GUI -- abbreviate durations
    
    Map days -> d; hours -> h; minutes -> m
    
    Signed-off-by: Kevin Wasserman <kevin.wasserman at painless-security.com>
    
    ticket: 7285 (new)
    queue: kfw
    target_version: 1.10.4
    tags: pullup

 src/windows/leash/LeashView.cpp |   18 ++++--------------
 1 files changed, 4 insertions(+), 14 deletions(-)

diff --git a/src/windows/leash/LeashView.cpp b/src/windows/leash/LeashView.cpp
index 298bee7..ceac1c4 100644
--- a/src/windows/leash/LeashView.cpp
+++ b/src/windows/leash/LeashView.cpp
@@ -309,25 +309,15 @@ void DurationToString(long delta, LPTSTR *outStr)
     delta -= hours * SECONDS_PER_HOUR;
     minutes = delta / SECONDS_PER_MINUTE;
 
-    if (minutes != 1)
-        _snprintf(minutesStr, MAX_DURATION_STR, "%d minutes", minutes);
-    else
-        _snprintf(minutesStr, MAX_DURATION_STR, "1 minute");
+    _snprintf(minutesStr, MAX_DURATION_STR, "%d m", minutes);
     minutesStr[MAX_DURATION_STR] = 0;
 
-    if (hours != 1)
-        _snprintf(hoursStr, MAX_DURATION_STR, "%d hours", hours);
-    else
-        _snprintf(hoursStr, MAX_DURATION_STR, "1 hour");
+    _snprintf(hoursStr, MAX_DURATION_STR, "%d h", hours);
     hoursStr[MAX_DURATION_STR] = 0;
 
     if (days > 0) {
-        if (days > 1)
-            _snprintf(*outStr, MAX_DURATION_STR, "(%d days, %s remaining)",
-                      days, hoursStr);
-        else
-            _snprintf(*outStr, MAX_DURATION_STR, "(1 day, %s remaining)",
-                      hoursStr);
+        _snprintf(*outStr, MAX_DURATION_STR, "(%d d, %s remaining)", days,
+                  hoursStr);
     } else if (hours > 0) {
         _snprintf(*outStr, MAX_DURATION_STR, "(%s, %s remaining)", hoursStr,
                   minutesStr);


More information about the cvs-krb5 mailing list