aboutsummaryrefslogtreecommitdiff
path: root/Src/Wasabi/bfc/util/timefmt.h
diff options
context:
space:
mode:
Diffstat (limited to 'Src/Wasabi/bfc/util/timefmt.h')
-rw-r--r--Src/Wasabi/bfc/util/timefmt.h46
1 files changed, 46 insertions, 0 deletions
diff --git a/Src/Wasabi/bfc/util/timefmt.h b/Src/Wasabi/bfc/util/timefmt.h
new file mode 100644
index 00000000..b24e0a99
--- /dev/null
+++ b/Src/Wasabi/bfc/util/timefmt.h
@@ -0,0 +1,46 @@
+//PORTABLE
+#ifndef _TIMEFMT_H
+#define _TIMEFMT_H
+
+/**
+ Simple time formatting. Can format into a minutes:seconds style
+ display based on count in seconds only.
+
+ Can also format a timestamp into human readable format.
+
+ @author Nullsoft
+ @ver 1.0
+*/
+class TimeFmt {
+public:
+ /**
+ Formats a time value in seconds to minute:seconds.
+
+ If the buffer is too small, the string will be
+ truncated.
+
+ @param seconds Time value to convert.
+ @param buf Buffer to receive formatted string.
+ @param buflen Length of the buffer.
+ */
+ static void printMinSec(int seconds, wchar_t *buf, int buflen);
+ static void printHourMinSec(int seconds, wchar_t *buf, int buflen, int hoursonlyifneeded=0);
+
+ /**
+ Formats a time value (from unix timestamp) to
+ human readable format.
+
+ If the buffer is too small, the string will be
+ truncated.
+
+ Example of formatted output:
+ Tue Sep 10 18:34:42 PDT 2002
+
+ @param buf Buffer to receive the formatted string.
+ @param bufsize Length of the buffer.
+ @param ts The timestamp to use.
+ */
+ static void printTimeStamp(wchar_t *buf, int bufsize, int ts);
+};
+
+#endif