$search
00001 #include <ros/duration.h> 00002 #include <ros/impl/duration.h> 00003 00004 namespace ros { 00005 00006 void normalizeSecNSecSigned(int64_t& sec, int64_t& nsec) 00007 { 00008 int64_t nsec_part = nsec; 00009 int64_t sec_part = sec; 00010 00011 while (nsec_part > 1000000000L) 00012 { 00013 nsec_part -= 1000000000L; 00014 ++sec_part; 00015 } 00016 while (nsec_part < 0) 00017 { 00018 nsec_part += 1000000000L; 00019 --sec_part; 00020 } 00021 00022 if (sec_part < INT_MIN || sec_part > INT_MAX) 00023 throw std::runtime_error("Duration is out of dual 32-bit range"); 00024 00025 sec = sec_part; 00026 nsec = nsec_part; 00027 } 00028 00029 void normalizeSecNSecSigned(int32_t& sec, int32_t& nsec) 00030 { 00031 int64_t sec64 = sec; 00032 int64_t nsec64 = nsec; 00033 00034 normalizeSecNSecSigned(sec64, nsec64); 00035 00036 sec = (int32_t)sec64; 00037 nsec = (int32_t)nsec64; 00038 } 00039 00040 template class DurationBase<Duration>; 00041 template class DurationBase<WallDuration>; 00042 } 00043