Comments (3)
Further testing brings up another problem:
// check with C functions
tm tm;
tm.tm_year = year - 1900;
tm.tm_mon = month - 1;
tm.tm_mday = day;
tm.tm_hour = hour;
tm.tm_min = minute;
tm.tm_sec = second;
tm.tm_isdst = 0;
const time_t t = mktime(&tm);
LOG(Info, "Time structure constructed with C function: {0}, time_t={1}", String(ctime(&t)), t);
const auto dt2 = DateTime::FromUnixTimestamp(t);
LOG(Info, "results in {0} (ticks={1})", dt2, dt2.Ticks);
// this should be the same as dt1 - milliseconds
LOG(Info, "Expected difference is {0}ms, actually is {1} ticks", millisecond, (dt1-dt2).Ticks);
const auto t2 = dt1.ToUnixTimestamp();
if (t != t2)
LOG(Warning, "timestamps differ: DateTime example: {0}, should be: {1}", t2, t);
writes:
[ 00:57:19.968 ]: [Info] Time structure constructed with C function: Sat Dec 16 23:50:13 2023
, time_t=1702767013
[ 00:57:19.968 ]: [Info] results in 2023-12-17 22:50:13 (ticks=638383638130000000)
[ 00:57:19.968 ]: [Info] Expected difference is 5ms, actually is 36000050000 ticks
[ 01:04:33.652 ]: [Warning] timestamps differ: DateTime example: 1702770613, should be: 1702767013
from flaxengine.
This leads to weird results as in:
// check TZ
DateTime local = DateTime::Now();
DateTime nowInUTC = DateTime::NowUTC();
LOG(Info, "difference between local ({1}) and UTC ({2}) is {0}", local - nowInUTC, local, nowInUTC);
LOG(Info, "hours local - hours in UTC is {0}", local.GetHour() - nowInUTC.GetHour());
LOG(Info, "day*24+hours local - UTC is {0}", (local.GetDay() * 24 + local.GetHour()) - (nowInUTC.GetDay() * 24 + nowInUTC.GetHour()));
[ 01:23:33.440 ]: [Info] difference between local (2023-12-29 00:38:06) and UTC (2023-12-29 23:38:06) is 01:00:00.0000000
[ 01:23:33.440 ]: [Info] hours local - hours in UTC is -23
[ 01:23:33.440 ]: [Info] day*24+hours local - UTC is -23
The difference of one hour is correct for my timezone but the difference days*24 + hours should be one hour as well (as long as it's the same month of course).
from flaxengine.
Fixed in 976d099. Also, added unit test with your sample code to ensure it's always working.
from flaxengine.
Related Issues (20)
- Vertex colors are wrong when importing gltf.
- Realtime environment probes doesnt work
- C++ API_INTERFACE name clash in plugins HOT 6
- Plugins written in C++ don't compile in Visual Studio out of the box HOT 2
- Types in C++ Plugins downloaded with the plugin tool are not found in C# by VS IntelliSense HOT 6
- [Suggestion] Improve material editor drag and drop multiple textures
- [Linux] Error creating and opening the project HOT 2
- Visual script function nodes not using default parameters from C#. HOT 1
- Asset editor window layout is restored before editor plugins are loaded, resulting in broken asset types. HOT 1
- Suggestion: Add a (spreadsheet-like) table to the editor UI
- Cooking on Linux does not work anymore HOT 4
- Attempting to create a prefab from the scene with a colon (:) in the name results in an empty, non-prefab file HOT 1
- [Suggestion] Allow inverting multiple texture channels on import
- Rigidbody with constraints ignore collisions but react to gravity HOT 3
- Android build issue HOT 2
- Sprite parameters cannot exceed 4096 HOT 1
- Suggestion: Terrain multi height map layers by terrain patch
- [TRACKER] Potential Development Halting Issues. HOT 3
- [Task] Fix seter and add getter (complete the to do in bindings) for Function<>
- [Task] fix bindings bug the API_FUNCTION void Funcionname(Delegate<>) generets invalid code
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from flaxengine.