aboutsummaryrefslogtreecommitdiff
path: root/Src/Wasabi/bfc/util/timefmt.h
diff options
context:
space:
mode:
authorJef <jef@targetspot.com>2024-09-24 08:54:57 -0400
committerJef <jef@targetspot.com>2024-09-24 08:54:57 -0400
commit20d28e80a5c861a9d5f449ea911ab75b4f37ad0d (patch)
tree12f17f78986871dd2cfb0a56e5e93b545c1ae0d0 /Src/Wasabi/bfc/util/timefmt.h
parent537bcbc86291b32fc04ae4133ce4d7cac8ebe9a7 (diff)
downloadwinamp-20d28e80a5c861a9d5f449ea911ab75b4f37ad0d.tar.gz
Initial community commit
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