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

Fix Time.get_unix_time_from_system() not including msecs

This commit is contained in:
Haoyu Qiu
2022-08-08 17:45:32 +08:00
parent 5b4e7a0693
commit 1be078ebcb
10 changed files with 49 additions and 1 deletions

View File

@@ -172,6 +172,12 @@ uint64_t OS_Unix::get_system_time_msecs() const {
return uint64_t(tv_now.tv_sec) * 1000 + uint64_t(tv_now.tv_usec) / 1000;
}
double OS_Unix::get_subsecond_unix_time() const {
struct timeval tv_now;
gettimeofday(&tv_now, nullptr);
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);
struct tm lt;