aboutsummaryrefslogtreecommitdiff
path: root/drivers/unix/os_unix.cpp
diff options
context:
space:
mode:
authorest312015-06-06 03:40:56 +0200
committerest312015-06-06 05:55:28 +0200
commit803069886ebca492c0d5f47133ccf7833c716e5a (patch)
tree711fbad4ba24fe58c7284e177a16bea6adc9eef5 /drivers/unix/os_unix.cpp
parent26ea12a873d0e7c1467ee6b52c9559dc5f456bd3 (diff)
downloadgodot-803069886ebca492c0d5f47133ccf7833c716e5a.tar.gz
godot-803069886ebca492c0d5f47133ccf7833c716e5a.tar.zst
godot-803069886ebca492c0d5f47133ccf7833c716e5a.zip
Diffstat (limited to 'drivers/unix/os_unix.cpp')
-rw-r--r--drivers/unix/os_unix.cpp17
1 files changed, 12 insertions, 5 deletions
diff --git a/drivers/unix/os_unix.cpp b/drivers/unix/os_unix.cpp
index d558aadc8..afb85e49e 100644
--- a/drivers/unix/os_unix.cpp
+++ b/drivers/unix/os_unix.cpp
@@ -218,10 +218,14 @@ uint64_t OS_Unix::get_unix_time() const {
};
-OS::Date OS_Unix::get_date() const {
+OS::Date OS_Unix::get_date(bool utc) const {
time_t t=time(NULL);
- struct tm *lt=localtime(&t);
+ struct tm *lt;
+ if (utc)
+ lt=gmtime(&t);
+ else
+ lt=localtime(&t);
Date ret;
ret.year=1900+lt->tm_year;
ret.month=(Month)lt->tm_mon;
@@ -231,10 +235,13 @@ OS::Date OS_Unix::get_date() const {
return ret;
}
-OS::Time OS_Unix::get_time() const {
-
+OS::Time OS_Unix::get_time(bool utc) const {
time_t t=time(NULL);
- struct tm *lt=localtime(&t);
+ struct tm *lt;
+ if (utc)
+ lt=gmtime(&t);
+ else
+ lt=localtime(&t);
Time ret;
ret.hour=lt->tm_hour;
ret.min=lt->tm_min;