OpenCoverage

gettime.c

Absolute File Name:/home/opencoverage/opencoverage/guest-scripts/coreutils/src/gnulib/lib/gettime.c
Source codeSwitch to Preprocessed file
LineSourceCount
1/* gettime -- get the system clock-
2-
3 Copyright (C) 2002, 2004-2007, 2009-2018 Free Software Foundation, Inc.-
4-
5 This program is free software: you can redistribute it and/or modify-
6 it under the terms of the GNU General Public License as published by-
7 the Free Software Foundation; either version 3 of the License, or-
8 (at your option) any later version.-
9-
10 This program is distributed in the hope that it will be useful,-
11 but WITHOUT ANY WARRANTY; without even the implied warranty of-
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the-
13 GNU General Public License for more details.-
14-
15 You should have received a copy of the GNU General Public License-
16 along with this program. If not, see <https://www.gnu.org/licenses/>. */-
17-
18/* Written by Paul Eggert. */-
19-
20#include <config.h>-
21-
22#include "timespec.h"-
23-
24#include <sys/time.h>-
25-
26/* Get the system time into *TS. */-
27-
28void-
29gettime (struct timespec *ts)-
30{-
31#if HAVE_NANOTIME-
32 nanotime (ts);-
33#else-
34-
35# if defined CLOCK_REALTIME && HAVE_CLOCK_GETTIME-
36 if (clock_gettime (CLOCK_REALTIME, ts) == 0)
clock_gettime ( 0 , ts) == 0Description
TRUEevaluated 1621 times by 5 tests
Evaluated by:
  • date
  • ls
  • pr
  • touch
  • vdir
FALSEnever evaluated
0-1621
37 return;
executed 1621 times by 5 tests: return;
Executed by:
  • date
  • ls
  • pr
  • touch
  • vdir
1621
38# endif-
39-
40 {-
41 struct timeval tv;-
42 gettimeofday (&tv, NULL);-
43 ts->tv_sec = tv.tv_sec;-
44 ts->tv_nsec = tv.tv_usec * 1000;-
45 }-
46-
47#endif-
48}
never executed: end of block
0
Source codeSwitch to Preprocessed file

Generated by Squish Coco 4.1.2