Medical Imaging Interaction Toolkit  2018.4.99-389bf124
Medical Imaging Interaction Toolkit
mitkLinuxRealTimeClock.cpp
Go to the documentation of this file.
1 /*============================================================================
2 
3 The Medical Imaging Interaction Toolkit (MITK)
4 
5 Copyright (c) German Cancer Research Center (DKFZ)
6 All rights reserved.
7 
8 Use of this source code is governed by a 3-clause BSD license that can be
9 found in the LICENSE file.
10 
11 ============================================================================*/
12 
13 #include "mitkLinuxRealTimeClock.h"
14 
15 #include <sys/time.h>
16 
17 
22 {
23 }
24 
29 {
30 }
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 }
double GetCurrentStamp() override
returns the current time in milliseconds as a double
~LinuxRealTimeClock() override
basic contructor
LinuxRealTimeClock()
basic contructor