Main Page
Namespaces
Classes
Files
File List
File Members
client
ros_lib
time.cpp
Go to the documentation of this file.
1
/*
2
* Copyright 2017 Fraunhofer Institute for Manufacturing Engineering and Automation (IPA)
3
*
4
* Licensed under the Apache License, Version 2.0 (the "License");
5
* you may not use this file except in compliance with the License.
6
* You may obtain a copy of the License at
7
*
8
* http://www.apache.org/licenses/LICENSE-2.0
9
10
* Unless required by applicable law or agreed to in writing, software
11
* distributed under the License is distributed on an "AS IS" BASIS,
12
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
* See the License for the specific language governing permissions and
14
* limitations under the License.
15
*/
16
17
18
#include "ros/time.h"
19
20
namespace
ros
21
{
22
void
normalizeSecNSec
(uint32_t& sec, uint32_t& nsec){
23
uint32_t nsec_part= nsec % 1000000000UL;
24
uint32_t sec_part = nsec / 1000000000UL;
25
sec += sec_part;
26
nsec = nsec_part;
27
}
28
29
Time
& Time::fromNSec(int32_t t)
30
{
31
sec = t / 1000000000;
32
nsec = t % 1000000000;
33
normalizeSecNSec
(sec, nsec);
34
return
*
this
;
35
}
36
37
Time
& Time::operator +=(
const
Duration
&rhs)
38
{
39
sec += rhs.sec;
40
nsec += rhs.nsec;
41
normalizeSecNSec
(sec, nsec);
42
return
*
this
;
43
}
44
45
Time
& Time::operator -=(
const
Duration
&rhs){
46
sec += -rhs.sec;
47
nsec += -rhs.nsec;
48
normalizeSecNSec
(sec, nsec);
49
return
*
this
;
50
}
51
}
ros::Time
Definition:
time.h:30
ros::normalizeSecNSec
ROSTIME_DECL void normalizeSecNSec(uint32_t &sec, uint32_t &nsec)
Definition:
time.cpp:22
ros
ros::Duration
Definition:
duration.h:28
cob_hand_bridge
Author(s): Mathias Lüdtke
autogenerated on Tue Oct 20 2020 03:35:57