cisst-saw
Loading...
Searching...
No Matches
osaTimeServer.h
Go to the documentation of this file.
1/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2/* ex: set filetype=cpp softtabstop=4 shiftwidth=4 tabstop=4 cindent expandtab: */
3
4/*
5
6 Author(s): Peter Kazanzides
7 Created on: 2008-12-30
8
9 (C) Copyright 2008-2011 Johns Hopkins University (JHU), All Rights Reserved.
10
11--- begin cisst license - do not edit ---
12
13This software is provided "as is" under an open source license, with
14no warranty. The complete license can be found in license.txt and
15http://www.cisst.org/cisst/license.txt.
16
17--- end cisst license ---
18*/
19
20
25
26#ifndef _osaTimeServer_h
27#define _osaTimeServer_h
28
31
32// Always include last
34
35// PKAZ: move this to osaGetTime.h
37 long sec; // seconds
38 long nsec; // nano-seconds
39
40 osaAbsoluteTime() : sec(0L), nsec(0L) {}
41 osaAbsoluteTime(long seconds, long nanoseconds) : sec(seconds), nsec(nanoseconds) {}
43
45 double ToSeconds(void) const;
46
48 void FromSeconds(double timeInSeconds);
49};
50
51
72
74{
76
77 friend class osaTimeServerTest;
78
80 enum {INTERNALS_SIZE = 32};
81 char Internals[INTERNALS_SIZE];
82
85 static unsigned int SizeOfInternals(void);
86
89 void Synchronize(void);
90
91public:
96
100 void SetTimeOrigin(void);
101
106
110 bool GetTimeOrigin(osaAbsoluteTime & origin) const;
111
114 double GetRelativeTime(void) const;
115
118 double GetAbsoluteTimeInSeconds(void) const;
119
123
125 double EstimateDrift(void) const;
126
132 void RelativeToAbsolute(double relative, osaAbsoluteTime & absolute) const;
133
139 double AbsoluteToRelative(const osaAbsoluteTime & absolute) const;
140};
141
142
144
145
146#endif // _osaTimeServer_h
147
Base class for high level objects.
Definition cmnGenericObject.h:53
Class for relative time.
Definition osaTimeServer.h:74
void SetTimeOriginFrom(const osaTimeServer *other)
double GetRelativeTime(void) const
double AbsoluteToRelative(const osaAbsoluteTime &absolute) const
double EstimateDrift(void) const
osaAbsoluteTime GetAbsoluteTime(void) const
void RelativeToAbsolute(double relative, osaAbsoluteTime &absolute) const
friend class osaTimeServerTest
Definition osaTimeServer.h:77
bool GetTimeOrigin(osaAbsoluteTime &origin) const
double GetAbsoluteTimeInSeconds(void) const
void SetTimeOrigin(void)
Class register definitions and log macros.
#define CMN_DECLARE_SERVICES_INSTANTIATION(className)
Definition cmnClassRegisterMacros.h:199
const int CMN_NO_DYNAMIC_CREATION
Definition cmnClassRegisterMacros.h:325
#define CISST_EXPORT
Definition cmnExportMacros.h:50
Defines cmnGenericObject.
#define CMN_LOG_ALLOW_DEFAULT
Definition cmnLogLoD.h:76
Macros to export the symbols of cisstOSAbstraction (in a Dll).
Definition osaTimeServer.h:36
long nsec
Definition osaTimeServer.h:38
double ToSeconds(void) const
osaAbsoluteTime()
Definition osaTimeServer.h:40
osaAbsoluteTime(long seconds, long nanoseconds)
Definition osaTimeServer.h:41
long sec
Definition osaTimeServer.h:37
void FromSeconds(double timeInSeconds)
~osaAbsoluteTime()
Definition osaTimeServer.h:42