MITK-IGT
IGT Extension of MITK
Loading...
Searching...
No Matches
mitkLinuxRealTimeClock.cpp
Go to the documentation of this file.
1/*============================================================================
2
3The Medical Imaging Interaction Toolkit (MITK)
4
5Copyright (c) German Cancer Research Center (DKFZ)
6All rights reserved.
7
8Use of this source code is governed by a 3-clause BSD license that can be
9found in the LICENSE file.
10
11============================================================================*/
12
14
15#include <sys/time.h>
16
17
24
31
41{
42 struct timeval tval;
43
44 if ( ::gettimeofday( &tval, nullptr )!= 0 )
45 {
46 itkGenericOutputMacro("gettimeofday-method could not successfully acquire the current time");
47 return -1;
48 }
49 double milliseconds;
50
51 milliseconds = static_cast< double >( tval.tv_sec ) +
52 static_cast< double >( tval.tv_usec ) / 1e6;
53
54 return milliseconds*1000; // in milliseconds
55}
~LinuxRealTimeClock() override
basic contructor
double GetCurrentStamp() override
returns the current time in milliseconds as a double