aboutsummaryrefslogtreecommitdiffstats
path: root/util
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
parentsome bug fixes (diff)
downloadgnupg-47c61bafe3545f17e8244902dca0ff00077d0feb.tar.gz
gnupg-47c61bafe3545f17e8244902dca0ff00077d0feb.zip
Expiration time works (I hope so)
Diffstat (limited to 'util')
-rw-r--r--util/ChangeLog4
-rw-r--r--util/miscutil.c29
2 files changed, 33 insertions, 0 deletions
diff --git a/util/ChangeLog b/util/ChangeLog
index 38f68cdde..ce70b85a8 100644
--- a/util/ChangeLog
+++ b/util/ChangeLog
@@ -1,3 +1,7 @@
+Thu Nov 19 07:09:55 1998 Werner Koch <[email protected]>
+
+ * miscutil.c (strtimevalue): New.
+
Tue Nov 10 10:01:53 1998 Werner Koch ([email protected])
* strgutil.c (set_native_charset): New.
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
*/