summaryrefslogtreecommitdiffstats
path: root/src/lib/des425/unix_time.c
blob: 53ce03b686a3b08c370597377d09c42c716d885a (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
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
/*
 * unix_time.c
 * 
 * Glue code for pasting Kerberos into the Unix environment.
 *
 * Originally written by John Gilmore, Cygnus Support, May '94.
 * Public Domain.
 *
 * Required for use by the Cygnus krb.a.
 */


#include "k5-int.h"

#if !defined(_WIN32)
#include <sys/time.h>

krb5_ui_4
unix_time_gmt_unixsec (usecptr)
     krb5_ui_4	*usecptr;
{
	struct timeval	now;

	(void) gettimeofday (&now, (struct timezone *)0);
	if (usecptr)
		*usecptr = now.tv_usec;
	return now.tv_sec;
}

#endif /* !_WIN32 */

#ifdef _WIN32
#include <time.h>

krb5_ui_4
unix_time_gmt_unixsec (usecptr)
    krb5_ui_4 *usecptr;
{
    time_t gmt;

    time(&gmt);
    if (usecptr)
	*usecptr = gmt;
    return gmt;
}
#endif /* _WIN32 */