MCPcopy Create free account
hub / github.com/HaxeFoundation/hxcpp / __hxcpp_from_utc

Function __hxcpp_from_utc

src/hx/Date.cpp:408–427  ·  view source on GitHub ↗

* input: takes Y-M-D h:m:s.ms (considers that date parts are in UTC date_time representation) * output: returns UTC time stamp (Epoch), in seconds */

Source from the content-addressed store, hash-verified

406 * output: returns UTC time stamp (Epoch), in seconds
407 */
408double __hxcpp_from_utc(int inYear,int inMonth,int inDay,int inHour, int inMin, int inSeconds, int inMilliseconds)
409{
410 struct tm time;
411
412 time.tm_isdst = -1;
413 time.tm_year = inYear - 1900;
414 time.tm_mon = inMonth;
415 time.tm_mday = inDay;
416 time.tm_hour = inHour;
417 time.tm_min = inMin;
418 time.tm_sec = inSeconds;
419
420 time_t z = mktime(&time);
421 time_t t = z + __hxcpp_timezone_offset(z);
422
423 struct tm local_tm;
424 __internal_localtime( t, &local_tm);
425
426 return (mktime(&local_tm) + ((double) inMilliseconds * 0.001));
427}
428

Callers

nothing calls this directly

Calls 2

__hxcpp_timezone_offsetFunction · 0.85
__internal_localtimeFunction · 0.85

Tested by

no test coverage detected