1
0
mirror of https://github.com/godotengine/godot.git synced 2025-11-04 12:00:25 +00:00

Remove OS.get_system_time_secs/get_system_time_msecs and change OS.get_unix_time return type to double

This commit is contained in:
Emmanuel Leblond
2020-05-31 14:19:31 +02:00
parent a8787d1ae5
commit c6de3872f9
9 changed files with 20 additions and 90 deletions

View File

@@ -163,22 +163,12 @@ String OS_Unix::get_name() const {
return "Unix";
}
uint64_t OS_Unix::get_unix_time() const {
return time(nullptr);
double OS_Unix::get_unix_time() const {
struct timeval tv_now;
gettimeofday(&tv_now, nullptr);
return (double)tv_now.tv_sec + double(tv_now.tv_usec) / 1000000;
};
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 {
struct timeval tv_now;
gettimeofday(&tv_now, nullptr);
return uint64_t(tv_now.tv_sec) * 1000 + uint64_t(tv_now.tv_usec) / 1000;
}
OS::Date OS_Unix::get_date(bool utc) const {
time_t t = time(nullptr);
struct tm *lt;