diff options
| author | Juan Linietsky | 2015-08-08 11:04:12 -0300 |
|---|---|---|
| committer | Juan Linietsky | 2015-08-08 11:04:12 -0300 |
| commit | 568679b7c4c14141aab0c96e4a1ab54afeb9ccac (patch) | |
| tree | 1da87f63bf06bfe3932a3caacc743749b4a37140 /drivers/unix/os_unix.cpp | |
| parent | ffb57a9183184221fc5e203f636edca4b588e301 (diff) | |
| parent | 6b25e83ba73ae3321aff00d7b3192d8cd80c410c (diff) | |
| download | godot-568679b7c4c14141aab0c96e4a1ab54afeb9ccac.tar.gz godot-568679b7c4c14141aab0c96e4a1ab54afeb9ccac.tar.zst godot-568679b7c4c14141aab0c96e4a1ab54afeb9ccac.zip | |
Merge pull request #2341 from xodene/patch-5/OS_get_system_time_msec
Add OS.get_system_time_msec
Diffstat (limited to 'drivers/unix/os_unix.cpp')
| -rw-r--r-- | drivers/unix/os_unix.cpp | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/drivers/unix/os_unix.cpp b/drivers/unix/os_unix.cpp index f6d9e0fb4..314e13cee 100644 --- a/drivers/unix/os_unix.cpp +++ b/drivers/unix/os_unix.cpp @@ -223,6 +223,14 @@ uint64_t OS_Unix::get_unix_time() const { return time(NULL); }; +uint64_t OS_Unix::get_system_time_msec() const { + struct timeval tv_now; + gettimeofday(&tv_now, NULL); + localtime(&tv_now.tv_usec); + uint64_t msec = tv_now.tv_usec/1000; + return msec; +} + OS::Date OS_Unix::get_date(bool utc) const { |
