OpenVAS Scanner 23.32.3
time.c File Reference

Unix SMB/CIFS implementation. time handling functions. More...

#include "byteorder.h"
#include "proto.h"
#include "smb.h"
#include <limits.h>
#include <sys/time.h>
#include <time.h>
#include <utime.h>
Include dependency graph for time.c:

Go to the source code of this file.

Macros

#define uint32   uint32_t
#define TIME_T_MIN
#define TIME_T_MAX   LONG_MAX
#define NTTIME_INFINITY   (NTTIME) 0x8000000000000000LL
#define TIME_FIXUP_CONSTANT_INT   11644473600LL

Functions

static void unix_timespec_to_nt_time_ntlmssp (NTTIME *nt, struct timespec ts)
void GetTimeOfDay_ntlmssp (struct timeval *tval)
static void put_long_date_timespec_ntlmssp (char *p, struct timespec ts)
void put_long_date_ntlmssp (char *p, time_t t)

Detailed Description

Unix SMB/CIFS implementation. time handling functions.

time handling functions

Definition in file time.c.

Macro Definition Documentation

◆ NTTIME_INFINITY

#define NTTIME_INFINITY   (NTTIME) 0x8000000000000000LL

Definition at line 44 of file time.c.

◆ TIME_FIXUP_CONSTANT_INT

#define TIME_FIXUP_CONSTANT_INT   11644473600LL

Definition at line 46 of file time.c.

Referenced by unix_timespec_to_nt_time_ntlmssp().

◆ TIME_T_MAX

#define TIME_T_MAX   LONG_MAX

Definition at line 41 of file time.c.

Referenced by unix_timespec_to_nt_time_ntlmssp().

◆ TIME_T_MIN

#define TIME_T_MIN
Value:
((time_t) 0 < (time_t) - 1 \
? (time_t) 0 \
: ~(time_t) 0 << (sizeof (time_t) * CHAR_BIT - 1))

Definition at line 35 of file time.c.

35#define TIME_T_MIN \
36 ((time_t) 0 < (time_t) - 1 \
37 ? (time_t) 0 \
38 : ~(time_t) 0 << (sizeof (time_t) * CHAR_BIT - 1))

◆ uint32

#define uint32   uint32_t

Definition at line 26 of file time.c.

Function Documentation

◆ GetTimeOfDay_ntlmssp()

void GetTimeOfDay_ntlmssp ( struct timeval * tval)

Definition at line 91 of file time.c.

92{
93 gettimeofday (tval, NULL);
94}

References timeval().

Referenced by do_reseed_ntlmssp().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ put_long_date_ntlmssp()

void put_long_date_ntlmssp ( char * p,
time_t t )

Definition at line 111 of file time.c.

112{
113 struct timespec ts;
114 ts.tv_sec = t;
115 ts.tv_nsec = 0;
117}
static void put_long_date_timespec_ntlmssp(char *p, struct timespec ts)
Definition time.c:102

References put_long_date_timespec_ntlmssp().

Referenced by NTLMv2_generate_client_data_ntlmssp().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ put_long_date_timespec_ntlmssp()

void put_long_date_timespec_ntlmssp ( char * p,
struct timespec ts )
static

Definition at line 102 of file time.c.

103{
104 NTTIME nt;
106 SIVAL (p, 0, nt & 0xFFFFFFFF);
107 SIVAL (p, 4, nt >> 32);
108}
#define SIVAL(buf, pos, val)
Definition byteorder.h:117
uint64_t NTTIME
Definition smb.h:170
static void unix_timespec_to_nt_time_ntlmssp(NTTIME *nt, struct timespec ts)
Definition time.c:53

References SIVAL, and unix_timespec_to_nt_time_ntlmssp().

Referenced by put_long_date_ntlmssp().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ unix_timespec_to_nt_time_ntlmssp()

void unix_timespec_to_nt_time_ntlmssp ( NTTIME * nt,
struct timespec ts )
static

Definition at line 53 of file time.c.

54{
55 uint64_t d;
56
57 if (ts.tv_sec == 0 && ts.tv_nsec == 0)
58 {
59 *nt = 0;
60 return;
61 }
62 if (ts.tv_sec == TIME_T_MAX)
63 {
64 *nt = 0x7fffffffffffffffLL;
65 return;
66 }
67 if (ts.tv_sec == (time_t) -1)
68 {
69 *nt = (uint64_t) -1;
70 return;
71 }
72
73 d = ts.tv_sec;
74 d += (uint64_t) TIME_FIXUP_CONSTANT_INT;
75 d *= 1000 * 1000 * 10;
76 /* d is now in 100ns units. */
77 d += (ts.tv_nsec / 100);
78
79 *nt = d;
80}
#define TIME_T_MAX
Definition time.c:41
#define TIME_FIXUP_CONSTANT_INT
Definition time.c:46

References TIME_FIXUP_CONSTANT_INT, and TIME_T_MAX.

Referenced by put_long_date_timespec_ntlmssp().

Here is the caller graph for this function: