summaryrefslogtreecommitdiff
path: root/drivers
diff options
context:
space:
mode:
Diffstat (limited to 'drivers')
-rw-r--r--drivers/unix/os_unix.cpp21
-rw-r--r--drivers/unix/os_unix.h3
2 files changed, 5 insertions, 19 deletions
diff --git a/drivers/unix/os_unix.cpp b/drivers/unix/os_unix.cpp
index 384f46c8df..beb2812999 100644
--- a/drivers/unix/os_unix.cpp
+++ b/drivers/unix/os_unix.cpp
@@ -200,7 +200,7 @@ double OS_Unix::get_unix_time() const {
return (double)tv_now.tv_sec + double(tv_now.tv_usec) / 1000000;
}
-OS::Date OS_Unix::get_date(bool p_utc) const {
+OS::DateTime OS_Unix::get_datetime(bool p_utc) const {
time_t t = time(nullptr);
struct tm lt;
if (p_utc) {
@@ -208,7 +208,7 @@ OS::Date OS_Unix::get_date(bool p_utc) const {
} else {
localtime_r(&t, &lt);
}
- Date ret;
+ DateTime ret;
ret.year = 1900 + lt.tm_year;
// Index starting at 1 to match OS_Unix::get_date
// and Windows SYSTEMTIME and tm_mon follows the typical structure
@@ -216,24 +216,11 @@ OS::Date OS_Unix::get_date(bool p_utc) const {
ret.month = (Month)(lt.tm_mon + 1);
ret.day = lt.tm_mday;
ret.weekday = (Weekday)lt.tm_wday;
- ret.dst = lt.tm_isdst;
-
- return ret;
-}
-
-OS::Time OS_Unix::get_time(bool p_utc) const {
- time_t t = time(nullptr);
- struct tm lt;
- if (p_utc) {
- gmtime_r(&t, &lt);
- } else {
- localtime_r(&t, &lt);
- }
- Time ret;
ret.hour = lt.tm_hour;
ret.minute = lt.tm_min;
ret.second = lt.tm_sec;
- get_time_zone_info();
+ ret.dst = lt.tm_isdst;
+
return ret;
}
diff --git a/drivers/unix/os_unix.h b/drivers/unix/os_unix.h
index f4609a565b..b4c844bfef 100644
--- a/drivers/unix/os_unix.h
+++ b/drivers/unix/os_unix.h
@@ -63,8 +63,7 @@ public:
virtual String get_name() const override;
- virtual Date get_date(bool p_utc) const override;
- virtual Time get_time(bool p_utc) const override;
+ virtual DateTime get_datetime(bool p_utc) const override;
virtual TimeZoneInfo get_time_zone_info() const override;
virtual double get_unix_time() const override;