summaryrefslogtreecommitdiff
path: root/CIAO/connectors/dds4ccm/impl/TimeUtilities.h
blob: dbb7476a908f269ee8547624725833cd638d8ecd (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
//=============================================================================
/**
 *  @file    TimeUtilities.h
 *
 *  @author  Marcel Smit (msmit@remedy.nl)
 */
//=============================================================================


#ifndef DDS4CCM_TIME_UTILITIES_H
#define DDS4CCM_TIME_UTILITIES_H

#include "ace/Time_Value.h"
#include "ace/Truncate.h"
#include "dds4ccm/idl/dds_rtf2_dcpsC.h"

inline void
operator<<= (::DDS::Time_t & dds_time, const ::ACE_Time_Value & ace_time)
{
  dds_time.sec = ACE_Utils::truncate_cast<CORBA::Long> (ace_time.sec ());
  dds_time.nanosec = ace_time.usec () * 1000;
}

inline void
operator<<= (::ACE_Time_Value & ace_time, const ::DDS::Time_t &dds_time)
{
  ace_time.sec (dds_time.sec);
  ace_time.usec (dds_time.nanosec/1000);
}

inline void
operator<<= (::ACE_Time_Value & ace_time, const ::DDS::Duration_t &dds_time)
{
  ace_time.sec (dds_time.sec);
  ace_time.usec (dds_time.nanosec/1000);
}

#endif /* DDS4CCM_TIME_UTILITIES_H */