summaryrefslogtreecommitdiff
path: root/core/fxcrt/fx_extension.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'core/fxcrt/fx_extension.cpp')
-rw-r--r--core/fxcrt/fx_extension.cpp14
1 files changed, 14 insertions, 0 deletions
diff --git a/core/fxcrt/fx_extension.cpp b/core/fxcrt/fx_extension.cpp
index c754a85508..8320b45db4 100644
--- a/core/fxcrt/fx_extension.cpp
+++ b/core/fxcrt/fx_extension.cpp
@@ -11,6 +11,9 @@
#include <limits>
#include "third_party/base/compiler_specific.h"
+#include "third_party/base/ptr_util.h"
+
+time_t (*time_func)() = []() -> time_t { return time(nullptr); };
float FXSYS_wcstof(const wchar_t* pwsStr, int32_t iLength, int32_t* pUsedLen) {
ASSERT(pwsStr);
@@ -167,3 +170,14 @@ size_t FXSYS_ToUTF16BE(uint32_t unicode, char* buf) {
FXSYS_IntToFourHexChars(0xDC00 + unicode % 0x400, buf + 4);
return 8;
}
+
+void FXSYS_SetTimeFunction(time_t (*func)()) {
+ time_func = func ? func : []() -> time_t { return time(nullptr); };
+}
+
+time_t FXSYS_time(time_t* tloc) {
+ time_t ret_val = time_func();
+ if (tloc)
+ *tloc = ret_val;
+ return ret_val;
+}