diff options
| author | Rémi Verschelde <rverschelde@gmail.com> | 2018-12-20 11:31:16 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2018-12-20 11:31:16 +0100 |
| commit | a8faa5504279f867adb6f50f768d3cf00594dc4f (patch) | |
| tree | f4751774263c4b2dc184044436539274ce3504a1 /drivers/unix/os_unix.cpp | |
| parent | b3f6e54cc61086fc3a3d2af170a86ea6a6eebf73 (diff) | |
| parent | 84d060c768c10145374d48ebd2b3f00430c73638 (diff) | |
| download | redot-engine-a8faa5504279f867adb6f50f768d3cf00594dc4f.tar.gz | |
Merge pull request #24485 from volzhs/system-time-ms
Added OS.get_system_time_msecs()
Diffstat (limited to 'drivers/unix/os_unix.cpp')
| -rw-r--r-- | drivers/unix/os_unix.cpp | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/drivers/unix/os_unix.cpp b/drivers/unix/os_unix.cpp index 279274734f..12a1263042 100644 --- a/drivers/unix/os_unix.cpp +++ b/drivers/unix/os_unix.cpp @@ -202,6 +202,12 @@ uint64_t OS_Unix::get_system_time_secs() const { return uint64_t(tv_now.tv_sec); } +uint64_t OS_Unix::get_system_time_msecs() const { + struct timeval tv_now; + gettimeofday(&tv_now, NULL); + return uint64_t(tv_now.tv_sec * 1000 + tv_now.tv_usec / 1000); +} + OS::Date OS_Unix::get_date(bool utc) const { time_t t = time(NULL); |
