OpenVAS Scanner 22.7.9
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 43 of file time.c.

◆ TIME_FIXUP_CONSTANT_INT

#define TIME_FIXUP_CONSTANT_INT   11644473600LL

Definition at line 45 of file time.c.

◆ TIME_T_MAX

#define TIME_T_MAX   LONG_MAX

Definition at line 40 of file time.c.

◆ 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.

◆ 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 90 of file time.c.

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

Referenced by do_reseed_ntlmssp().

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 110 of file time.c.

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

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()

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

Definition at line 101 of file time.c.

102{
103 NTTIME nt;
105 SIVAL (p, 0, nt & 0xFFFFFFFF);
106 SIVAL (p, 4, nt >> 32);
107}
#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:52

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()

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

Definition at line 52 of file time.c.

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

References TIME_FIXUP_CONSTANT_INT, and TIME_T_MAX.

Referenced by put_long_date_timespec_ntlmssp().

Here is the caller graph for this function: