• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

telefonicaid / fiware-orion / 43831928967

16 Nov 2026 08:31AM UTC coverage: 80.389% (-0.01%) from 80.401%
43831928967

push

github

web-flow
Merge pull request #4831 from fisuda/patch

(JP) Added documentation about coverage information (#4830)

21203 of 27923 branches covered (75.93%)

Branch coverage included in aggregate %.

17320 of 19998 relevant lines covered (86.61%)

114632.63 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

66.67
/src/lib/common/clockFunctions.cpp
1
/*
2
*
3
* Copyright 2015 Telefonica Investigacion y Desarrollo, S.A.U
4
*
5
* This file is part of Orion Context Broker.
6
*
7
* Orion Context Broker is free software: you can redistribute it and/or
8
* modify it under the terms of the GNU Affero General Public License as
9
* published by the Free Software Foundation, either version 3 of the
10
* License, or (at your option) any later version.
11
*
12
* Orion Context Broker is distributed in the hope that it will be useful,
13
* but WITHOUT ANY WARRANTY; without even the implied warranty of
14
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero
15
* General Public License for more details.
16
*
17
* You should have received a copy of the GNU Affero General Public License
18
* along with Orion Context Broker. If not, see http://www.gnu.org/licenses/.
19
*
20
* For those usages not covered by this license please contact with
21
* iot_support at tid dot es
22
*
23
* Author: Ken Zangelin
24
*/
25
#include <time.h>
26

27
#include "clockFunctions.h"
28

29

30

31
/* ****************************************************************************
32
*
33
* clock_difftime - 
34
*/
35
void clock_difftime(const struct timespec* endTime, const struct timespec* startTime, struct timespec* diffTime)
4,804 ✔
36
{
37
  diffTime->tv_nsec = endTime->tv_nsec - startTime->tv_nsec;
4,804 ✔
38
  diffTime->tv_sec  = endTime->tv_sec  - startTime->tv_sec;
4,804 ✔
39

40
  if (diffTime->tv_nsec < 0)
4,804 !
41
  {
42
    diffTime->tv_sec -= 1;
×
43
    diffTime->tv_nsec += 1000000000;
×
44
  }
45
}
4,804 ✔
46

47

48

49
/* ****************************************************************************
50
*
51
* clock_addtime - 
52
*/
53
void clock_addtime(struct timespec* accTime, const struct timespec* diffTime)
4,884 ✔
54
{
55
  accTime->tv_nsec += diffTime->tv_nsec;
4,884 ✔
56
  accTime->tv_sec  += diffTime->tv_sec;
4,884 ✔
57

58
  if (accTime->tv_nsec >= 1000000000)
4,884 !
59
  {
60
    accTime->tv_sec  += 1;
×
61
    accTime->tv_nsec -= 1000000000;
×
62
  }
63
}
4,884 ✔
64

65

66

67
/* ****************************************************************************
68
*
69
* clock_subtime - 
70
*/
71
void clock_subtime(struct timespec* subtrahend, const struct timespec* minuend)
24 ✔
72
{
73
  subtrahend->tv_sec  -= minuend->tv_sec;
24 ✔
74
  subtrahend->tv_nsec -= minuend->tv_nsec;
24 ✔
75

76
  if (subtrahend->tv_nsec < 0)
24 !
77
  {
78
    subtrahend->tv_sec  -= 1;
×
79
    subtrahend->tv_nsec += 1000000000;
×
80
  }
81
}
24 ✔
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE TRIAL · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc