Medical Imaging Interaction Toolkit  2016.11.0
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,
6 Division of Medical and Biological Informatics.
7 All rights reserved.
8 
9 This software is distributed WITHOUT ANY WARRANTY; without
10 even the implied warranty of MERCHANTABILITY or FITNESS FOR
11 A PARTICULAR PURPOSE.
12 
13 See LICENSE.txt or http://www.mitk.org for details.
14 
15 ===================================================================*/
16 
17 #include "mitkLinuxRealTimeClock.h"
18 
19 #include <sys/time.h>
20 
21 
26 {
27 }
28 
33 {
34 }
35 
45 {
46  struct timeval tval;
47 
48  if ( ::gettimeofday( &tval, nullptr )!= 0 )
49  {
50  itkGenericOutputMacro("gettimeofday-method could not successfully acquire the current time");
51  return -1;
52  }
53  double milliseconds;
54 
55  milliseconds = static_cast< double >( tval.tv_sec ) +
56  static_cast< double >( tval.tv_usec ) / 1e6;
57 
58  return milliseconds*1000; // in milliseconds
59 }
virtual double GetCurrentStamp() override
returns the current time in milliseconds as a double
LinuxRealTimeClock()
basic contructor
virtual ~LinuxRealTimeClock()
basic contructor