OpenVAS Scanner  7.0.0~git
time.c File Reference

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

#include "byteorder.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

void unix_timespec_to_nt_time_ntlmssp (NTTIME *nt, struct timespec ts)
 
void GetTimeOfDay_ntlmssp (struct timeval *tval)
 
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 55 of file time.c.

◆ TIME_FIXUP_CONSTANT_INT

#define TIME_FIXUP_CONSTANT_INT   11644473600LL

Definition at line 57 of file time.c.

◆ TIME_T_MAX

#define TIME_T_MAX   LONG_MAX

Definition at line 52 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 47 of file time.c.

◆ uint32

#define uint32   uint32_t

Definition at line 38 of file time.c.

Function Documentation

◆ GetTimeOfDay_ntlmssp()

void GetTimeOfDay_ntlmssp ( struct timeval tval)

Definition at line 102 of file time.c.

103 {
104  gettimeofday (tval, NULL);
105 }

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

123 {
124  struct timespec ts;
125  ts.tv_sec = t;
126  ts.tv_nsec = 0;
128 }

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 
)

Definition at line 113 of file time.c.

114 {
115  NTTIME nt;
117  SIVAL (p, 0, nt & 0xFFFFFFFF);
118  SIVAL (p, 4, nt >> 32);
119 }

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 
)

Definition at line 64 of file time.c.

65 {
66  uint64_t d;
67 
68  if (ts.tv_sec == 0 && ts.tv_nsec == 0)
69  {
70  *nt = 0;
71  return;
72  }
73  if (ts.tv_sec == TIME_T_MAX)
74  {
75  *nt = 0x7fffffffffffffffLL;
76  return;
77  }
78  if (ts.tv_sec == (time_t) -1)
79  {
80  *nt = (uint64_t) -1;
81  return;
82  }
83 
84  d = ts.tv_sec;
85  d += (uint64_t) TIME_FIXUP_CONSTANT_INT;
86  d *= 1000 * 1000 * 10;
87  /* d is now in 100ns units. */
88  d += (ts.tv_nsec / 100);
89 
90  *nt = d;
91 }

References TIME_FIXUP_CONSTANT_INT, and TIME_T_MAX.

Referenced by put_long_date_timespec_ntlmssp().

Here is the caller graph for this function:
put_long_date_timespec_ntlmssp
void put_long_date_timespec_ntlmssp(char *p, struct timespec ts)
Definition: time.c:113
unix_timespec_to_nt_time_ntlmssp
void unix_timespec_to_nt_time_ntlmssp(NTTIME *nt, struct timespec ts)
Definition: time.c:64
SIVAL
#define SIVAL(buf, pos, val)
Definition: byteorder.h:130
NTTIME
uint64_t NTTIME
Definition: smb.h:183
TIME_T_MAX
#define TIME_T_MAX
Definition: time.c:52
TIME_FIXUP_CONSTANT_INT
#define TIME_FIXUP_CONSTANT_INT
Definition: time.c:57