]> www.ginac.de Git - cln.git/blob - src/timing/cl_t_minus.cc
* All Files have been modified for inclusion of namespace cln;
[cln.git] / src / timing / cl_t_minus.cc
1 // operator- (const cl_timespec&, const cl_timespec&)
2
3 // General includes.
4 #include "cl_sysdep.h"
5
6 // Specification.
7 #include "cln/timing.h"
8
9
10 // Implementation.
11
12 namespace cln {
13
14 const cl_time_duration operator- (const cl_timespec& a, const cl_timespec& b)
15 {
16         var sintL sec = a.tv_sec - b.tv_sec;
17         var sintL nsec = a.tv_nsec - b.tv_nsec;
18         if (nsec < 0) {
19                 nsec += 1000000000;
20                 sec -= 1;
21         }
22         if (sec < 0) {
23                 sec = 0; nsec = 0;
24         }
25         return cl_time_duration(sec,nsec);
26 }
27
28 }  // namespace cln