MCPcopy Create free account
hub / github.com/Kitware/VTK / GetUniversalTime

Method GetUniversalTime

Common/System/vtkTimerLog.cxx:653–680  ·  view source on GitHub ↗

------------------------------------------------------------------------------ Returns the elapsed number of seconds since 00:00:00 Coordinated Universal Time (UTC), Thursday, 1 January 1970. This is also called Unix Time.

Source from the content-addressed store, hash-verified

651// Returns the elapsed number of seconds since 00:00:00 Coordinated Universal
652// Time (UTC), Thursday, 1 January 1970. This is also called Unix Time.
653double vtkTimerLog::GetUniversalTime()
654{
655 double currentTimeInSeconds;
656
657#ifdef _WIN32
658#ifdef _WIN32_WCE
659 FILETIME CurrentTime;
660 SYSTEMTIME st;
661 GetLocalTime(&st);
662 SystemTimeToFileTime(&st, &CurrentTime);
663 currentTimeInSeconds = CurrentTime.dwHighDateTime;
664 currentTimeInSeconds *= 429.4967296;
665 currentTimeInSeconds = currentTimeInSeconds + CurrentTime.dwLowDateTime / 10000000.0;
666#else
667 timeb CurrentTime;
668 static double scale = 1.0 / 1000.0;
669 ::ftime(&CurrentTime);
670 currentTimeInSeconds = CurrentTime.time + scale * CurrentTime.millitm;
671#endif
672#else
673 timeval CurrentTime;
674 static double scale = 1.0 / 1000000.0;
675 gettimeofday(&CurrentTime, nullptr);
676 currentTimeInSeconds = CurrentTime.tv_sec + scale * CurrentTime.tv_usec;
677#endif
678
679 return currentTimeInSeconds;
680}
681
682//------------------------------------------------------------------------------
683double vtkTimerLog::GetCPUTime()

Callers 1

TestMovieSphereFunction · 0.80

Calls 1

gettimeofdayFunction · 0.85

Tested by 1

TestMovieSphereFunction · 0.64