File: time.c

package info (click to toggle)
traceroute 1%3A2.0.20-2
  • links: PTS
  • area: main
  • in suites: jessie, jessie-kfreebsd
  • size: 556 kB
  • ctags: 559
  • sloc: ansic: 3,471; sh: 441; makefile: 97
file content (27 lines) | stat: -rw-r--r-- 501 bytes parent folder | download | duplicates (7)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
/*
    Copyright (c)  2006, 2007		Dmitry Butskoy
					<buc@citadel.stu.neva.ru>
    License:  GPL v2 or any later

    See COPYING for the status of this software.
*/

#include <stdlib.h>
#include <unistd.h>
#include <sys/time.h>

#include "traceroute.h"


/*  Just returns current time as double, with most possible precision...  */

double get_time (void) {
	struct timeval tv;
	double d;

	gettimeofday (&tv, NULL);

	d = ((double) tv.tv_usec) / 1000000. + (unsigned long) tv.tv_sec;

	return d;
}