aboutsummaryrefslogtreecommitdiffstats
path: root/util/miscutil.c
diff options
context:
space:
mode:
authorWerner Koch <[email protected]>1998-11-20 17:42:18 +0000
committerWerner Koch <[email protected]>1998-11-20 17:42:18 +0000
commit47c61bafe3545f17e8244902dca0ff00077d0feb (patch)
tree0867aa7d405a1df94ac360b5cc2814e97dcbe115 /util/miscutil.c
parentsome bug fixes (diff)
downloadgnupg-47c61bafe3545f17e8244902dca0ff00077d0feb.tar.gz
gnupg-47c61bafe3545f17e8244902dca0ff00077d0feb.zip
Expiration time works (I hope so)
Diffstat (limited to 'util/miscutil.c')
-rw-r--r--util/miscutil.c29
1 files changed, 29 insertions, 0 deletions
diff --git a/util/miscutil.c b/util/miscutil.c
index b9f8288d9..e31cb224f 100644
--- a/util/miscutil.c
+++ b/util/miscutil.c
@@ -39,6 +39,35 @@ add_days_to_timestamp( u32 stamp, u16 days )
return stamp + days*86400L;
}
+
+/****************
+ * Return a string with a time value in the form: x Y, n D, n H
+ */
+
+const char *
+strtimevalue( u32 value )
+{
+ static char buffer[30];
+ unsigned int years, days, hours, minutes;
+
+ value /= 60;
+ minutes = value % 60;
+ value /= 60;
+ hours = value % 24;
+ value /= 24;
+ days = value % 365;
+ value /= 365;
+ years = value;
+
+ sprintf(buffer,"%uy%ud%uh%um", years, days, hours, minutes );
+ if( years )
+ return buffer;
+ if( days )
+ return strchr( buffer, 'y' ) + 1;
+ return strchr( buffer, 'd' ) + 1;
+}
+
+
/****************
* Note: this function returns GMT
*/