blob: 53b124a80ee1b363db622df9965b97a0000b5fb5 (
plain)
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
28
29
|
/*
* gettstamp - return the system time in timestamp format
*/
#include <stdio.h>
#include <sys/time.h>
#include "ntp_fp.h"
#include "ntp_unixtime.h"
#include "ntp_stdlib.h"
void
gettstamp(ts)
l_fp *ts;
{
struct timeval tv;
/*
* Quickly get the time of day and convert it
*/
(void) GETTIMEOFDAY(&tv, (struct timezone *)NULL);
if (tv.tv_usec >= 1000000) { /* bum solaris */
tv.tv_usec -= 1000000;
tv.tv_sec++;
}
TVTOTS(&tv, ts);
ts->l_uf += TS_ROUNDBIT; /* guaranteed not to overflow */
ts->l_ui += JAN_1970;
ts->l_uf &= TS_MASK;
}
|