summaryrefslogtreecommitdiff
path: root/drivers
diff options
context:
space:
mode:
authorRĂ©mi Verschelde <rverschelde@gmail.com>2020-06-15 23:57:16 +0200
committerGitHub <noreply@github.com>2020-06-15 23:57:16 +0200
commit4b5b60de85fd264c57ef2dd90d0281cd8b4c05e1 (patch)
tree6b27343a22a160951328cb3ee48467421b41f668 /drivers
parente606b510aed533638a00180b6c00f2231da15175 (diff)
parentc6de3872f922256c9149f83067c9bef79566775b (diff)
Merge pull request #39189 from touilleMan/issue-38925
Unify OS.get_system_time_* and OS.get_unix_time
Diffstat (limited to 'drivers')
-rw-r--r--drivers/unix/os_unix.cpp16
-rw-r--r--drivers/unix/os_unix.h4
2 files changed, 4 insertions, 16 deletions
diff --git a/drivers/unix/os_unix.cpp b/drivers/unix/os_unix.cpp
index 083cd64116..9a5fc6d1a4 100644
--- a/drivers/unix/os_unix.cpp
+++ b/drivers/unix/os_unix.cpp
@@ -163,21 +163,11 @@ String OS_Unix::get_name() const {
return "Unix";
}
-uint64_t OS_Unix::get_unix_time() const {
- return time(nullptr);
-};
-
-uint64_t OS_Unix::get_system_time_secs() const {
- struct timeval tv_now;
- gettimeofday(&tv_now, nullptr);
- return uint64_t(tv_now.tv_sec);
-}
-
-uint64_t OS_Unix::get_system_time_msecs() const {
+double OS_Unix::get_unix_time() const {
struct timeval tv_now;
gettimeofday(&tv_now, nullptr);
- return uint64_t(tv_now.tv_sec) * 1000 + uint64_t(tv_now.tv_usec) / 1000;
-}
+ return (double)tv_now.tv_sec + double(tv_now.tv_usec) / 1000000;
+};
OS::Date OS_Unix::get_date(bool utc) const {
time_t t = time(nullptr);
diff --git a/drivers/unix/os_unix.h b/drivers/unix/os_unix.h
index 7d235803dc..2982e0c55c 100644
--- a/drivers/unix/os_unix.h
+++ b/drivers/unix/os_unix.h
@@ -77,9 +77,7 @@ public:
virtual Time get_time(bool utc) const;
virtual TimeZoneInfo get_time_zone_info() const;
- virtual uint64_t get_unix_time() const;
- virtual uint64_t get_system_time_secs() const;
- virtual uint64_t get_system_time_msecs() const;
+ virtual double get_unix_time() const;
virtual void delay_usec(uint32_t p_usec) const;
virtual uint64_t get_ticks_usec() const;