関数 | |
time_t | get_time_t_max (void) |
void | GetTimeOfDay (struct timeval *tval) |
time_t | nt_time_to_unix (NTTIME nt) |
void | unix_to_nt_time (NTTIME *nt, time_t t) |
BOOL | null_time (time_t t) |
BOOL | null_nttime (NTTIME t) |
BOOL | null_timespec (struct timespec ts) |
static uint16_t | make_dos_date1 (struct tm *t) |
static uint16_t | make_dos_time1 (struct tm *t) |
static uint32_t | make_dos_date (time_t unixdate, int zone_offset) |
void | push_dos_date (uint8_t *buf, int offset, time_t unixdate, int zone_offset) |
put a dos date into a buffer (time/date format) This takes GMT time and puts local time in the buffer | |
void | push_dos_date2 (uint8_t *buf, int offset, time_t unixdate, int zone_offset) |
put a dos date into a buffer (date/time format) This takes GMT time and puts local time in the buffer | |
void | push_dos_date3 (uint8_t *buf, int offset, time_t unixdate, int zone_offset) |
put a dos 32 bit "unix like" date into a buffer. | |
static void | interpret_dos_date (uint32_t date, int *year, int *month, int *day, int *hour, int *minute, int *second) |
time_t | pull_dos_date (const uint8_t *date_ptr, int zone_offset) |
create a unix date (int GMT) from a dos date (which is actually in localtime) | |
time_t | pull_dos_date2 (const uint8_t *date_ptr, int zone_offset) |
like make_unix_date() but the words are reversed | |
time_t | pull_dos_date3 (const uint8_t *date_ptr, int zone_offset) |
create a unix GMT date from a dos date in 32 bit "unix like" format these generally arrive as localtimes, with corresponding DST | |
char * | http_timestring (time_t t) |
char * | timestring (TALLOC_CTX *mem_ctx, time_t t) |
Return the date and time as a string | |
const char * | nt_time_string (TALLOC_CTX *mem_ctx, NTTIME nt) |
return a talloced string representing a NTTIME for human consumption | |
NTTIME | nttime_from_string (const char *s) |
parse a nttime as a large integer in a string and return a NTTIME | |
int64_t | usec_time_diff (struct timeval *tv1, struct timeval *tv2) |
return (tv1 - tv2) in microseconds | |
timeval | timeval_zero (void) |
return a zero timeval | |
BOOL | timeval_is_zero (const struct timeval *tv) |
return True if a timeval is zero | |
timeval | timeval_current (void) |
return a timeval for the current time | |
timeval | timeval_set (uint32_t secs, uint32_t usecs) |
return a timeval struct with the given elements | |
timeval | timeval_add (const struct timeval *tv, uint32_t secs, uint32_t usecs) |
return a timeval ofs microseconds after tv | |
timeval | timeval_sum (const struct timeval *tv1, const struct timeval *tv2) |
return the sum of two timeval structures | |
timeval | timeval_current_ofs (uint32_t secs, uint32_t usecs) |
return a timeval secs/usecs into the future | |
int | timeval_compare (const struct timeval *tv1, const struct timeval *tv2) |
compare two timeval structures. | |
BOOL | timeval_expired (const struct timeval *tv) |
return True if a timer is in the past | |
double | timeval_elapsed2 (const struct timeval *tv1, const struct timeval *tv2) |
return the number of seconds elapsed between two times | |
double | timeval_elapsed (const struct timeval *tv) |
return the number of seconds elapsed since a given time | |
timeval | timeval_min (const struct timeval *tv1, const struct timeval *tv2) |
return the lesser of two timevals | |
timeval | timeval_max (const struct timeval *tv1, const struct timeval *tv2) |
return the greater of two timevals | |
timeval | timeval_until (const struct timeval *tv1, const struct timeval *tv2) |
return the difference between two timevals as a timeval if tv1 comes after tv2, then return a zero timeval (this is *tv2 - *tv1) | |
NTTIME | timeval_to_nttime (const struct timeval *tv) |
convert a timeval to a NTTIME | |
uint32 | convert_time_t_to_uint32 (time_t t) |
time_t | convert_uint32_to_time_t (uint32 u) |
static int | tm_diff (struct tm *a, struct tm *b) |
int | get_time_zone (time_t t) |
BOOL | nt_time_is_zero (const NTTIME *nt) |
time_t | generalized_to_unix_time (const char *str) |
int | get_server_zone_offset (void) |
int | set_server_zone_offset (time_t t) |
char * | current_timestring (BOOL hires) |
static void | put_dos_date (char *buf, int offset, time_t unixdate, int zone_offset) |
static void | put_dos_date2 (char *buf, int offset, time_t unixdate, int zone_offset) |
static void | put_dos_date3 (char *buf, int offset, time_t unixdate, int zone_offset) |
void | srv_put_dos_date (char *buf, int offset, time_t unixdate) |
void | srv_put_dos_date2 (char *buf, int offset, time_t unixdate) |
void | srv_put_dos_date3 (char *buf, int offset, time_t unixdate) |
void | put_long_date_timespec (char *p, struct timespec ts) |
void | put_long_date (char *p, time_t t) |
time_t | get_create_time (const SMB_STRUCT_STAT *st, BOOL fake_dirs) |
timespec | get_create_timespec (const SMB_STRUCT_STAT *st, BOOL fake_dirs) |
timespec | get_atimespec (const SMB_STRUCT_STAT *pst) |
void | set_atimespec (SMB_STRUCT_STAT *pst, struct timespec ts) |
timespec | get_mtimespec (const SMB_STRUCT_STAT *pst) |
void | set_mtimespec (SMB_STRUCT_STAT *pst, struct timespec ts) |
timespec | get_ctimespec (const SMB_STRUCT_STAT *pst) |
void | set_ctimespec (SMB_STRUCT_STAT *pst, struct timespec ts) |
void | dos_filetime_timespec (struct timespec *tsp) |
static time_t | make_unix_date (const void *date_ptr, int zone_offset) |
static time_t | make_unix_date2 (const void *date_ptr, int zone_offset) |
static time_t | make_unix_date3 (const void *date_ptr, int zone_offset) |
time_t | srv_make_unix_date (const void *date_ptr) |
time_t | srv_make_unix_date2 (const void *date_ptr) |
time_t | srv_make_unix_date3 (const void *date_ptr) |
time_t | convert_timespec_to_time_t (struct timespec ts) |
timespec | convert_time_t_to_timespec (time_t t) |
timespec | convert_timeval_to_timespec (const struct timeval tv) |
timeval | convert_timespec_to_timeval (const struct timespec ts) |
timespec | timespec_current (void) |
timespec | timespec_min (const struct timespec *ts1, const struct timespec *ts2) |
int | timespec_compare (const struct timespec *ts1, const struct timespec *ts2) |
timespec | interpret_long_date (const char *p) |
void | cli_put_dos_date (struct cli_state *cli, char *buf, int offset, time_t unixdate) |
void | cli_put_dos_date2 (struct cli_state *cli, char *buf, int offset, time_t unixdate) |
void | cli_put_dos_date3 (struct cli_state *cli, char *buf, int offset, time_t unixdate) |
time_t | cli_make_unix_date (struct cli_state *cli, void *date_ptr) |
time_t | cli_make_unix_date2 (struct cli_state *cli, void *date_ptr) |
time_t | cli_make_unix_date3 (struct cli_state *cli, void *date_ptr) |
timespec | nt_time_to_unix_timespec (NTTIME *nt) |
BOOL | nt_time_equals (const NTTIME *nt1, const NTTIME *nt2) |
void | TimeInit (void) |
void | get_process_uptime (struct timeval *ret_time) |
time_t | nt_time_to_unix_abs (const NTTIME *nt) |
void | unix_timespec_to_nt_time (NTTIME *nt, struct timespec ts) |
void | unix_to_nt_time_abs (NTTIME *nt, time_t t) |
BOOL | null_mtime (time_t mtime) |
const char * | time_to_asc (const time_t t) |
const char * | display_time (NTTIME nttime) |
BOOL | nt_time_is_set (const NTTIME *nt) |
変数 | |
int | extra_time_offset = 0 |
static int | server_zone_offset |
static struct timeval | start_time_hires |
time.c で定義されています。
time_t get_time_t_max | ( | void | ) |
void GetTimeOfDay | ( | struct timeval * | tval | ) |
参照元 current_timestring()・do_get()・do_put()・do_reseed()・end_timer()・file_new()・get_process_uptime()・main()・name_query()・node_status_query()・print_fsp_open()・rebindproc_connect_with_state()・rebindproc_with_state()・receive_message_or_smb()・request_timed_out()・run_events()・set_domain_online()・set_domain_online_request()・smb_msleep()・smbldap_search_ext()・start_timer()・sys_select_intr()・sys_utmp_fill()・TimeInit()・timeout_until()・timespec_current()・timeval_current()・writetarheader().
00056 { 00057 #ifdef HAVE_GETTIMEOFDAY_TZ 00058 gettimeofday(tval,NULL); 00059 #else 00060 gettimeofday(tval); 00061 #endif 00062 }
time_t nt_time_to_unix | ( | NTTIME | nt | ) |
参照先 convert_timespec_to_time_t()・nt_time_to_unix_timespec().
参照元 append_info3_as_txt()・cac_MakeUserInfo()・cac_RegQueryKeyInfo()・copy_id21_to_sam_passwd()・copy_id23_to_sam_passwd()・copy_id25_to_sam_passwd()・display_sam_unk_info_13()・display_sam_unk_info_8()・display_sam_user_info_21()・fetch_account_info_to_ldif()・make_server_info_info3()・nt_time_string()・rpccli_reg_enum_key()・sam_account_from_delta()・winbindd_dual_pam_auth_cached().
00083 { 00084 return convert_timespec_to_time_t(nt_time_to_unix_timespec(&nt)); 00085 }
void unix_to_nt_time | ( | NTTIME * | nt, | |
time_t | t | |||
) |
参照元 cac_MakeUserInfoCtr()・init_net_user_info3()・init_reg_q_enum_key()・init_regf_block()・init_sam_user_info21A()・init_unk_info13()・init_unk_info8()・regfio_close()・regfio_write_key()・samba_extended_info_version()・winbindd_dual_pam_auth_cached().
00092 { 00093 uint64_t t2; 00094 00095 if (t == (time_t)-1) { 00096 *nt = (NTTIME)-1LL; 00097 return; 00098 } 00099 00100 if (t == TIME_T_MAX) { 00101 *nt = 0x7fffffffffffffffLL; 00102 return; 00103 } 00104 00105 if (t == 0) { 00106 *nt = 0; 00107 return; 00108 } 00109 00110 t2 = t; 00111 t2 += TIME_FIXUP_CONSTANT_INT; 00112 t2 *= 1000*1000*10; 00113 00114 *nt = t2; 00115 }
BOOL null_time | ( | time_t | t | ) |
BOOL null_timespec | ( | struct timespec | ts | ) |
参照元 call_trans2qfilepathinfo()・call_trans2setfilepathinfo()・close_normal_file()・fsp_set_pending_modtime()・real_write_file()・reply_setattrE()・set_ea_dos_attribute()・smb_set_file_allocation_info()・smb_set_file_basic_info()・smb_set_file_time().
00142 { 00143 return ts.tv_sec == 0 || 00144 ts.tv_sec == (time_t)0xFFFFFFFF || 00145 ts.tv_sec == (time_t)-1; 00146 }
static uint16_t make_dos_date1 | ( | struct tm * | t | ) | [static] |
static uint16_t make_dos_time1 | ( | struct tm * | t | ) | [static] |
static uint32_t make_dos_date | ( | time_t | unixdate, | |
int | zone_offset | |||
) | [static] |
参照先 gmtime()・make_dos_date1()・make_dos_time1()・t.
参照元 push_dos_date()・push_dos_date2()・put_dos_date()・put_dos_date2().
00175 { 00176 struct tm *t; 00177 uint32_t ret=0; 00178 00179 if (unixdate == 0) { 00180 return 0; 00181 } 00182 00183 unixdate -= zone_offset; 00184 00185 t = gmtime(&unixdate); 00186 if (!t) { 00187 return 0xFFFFFFFF; 00188 } 00189 00190 ret = make_dos_date1(t); 00191 ret = ((ret&0xFFFF)<<16) | make_dos_time1(t); 00192 00193 return ret; 00194 }
void push_dos_date | ( | uint8_t * | buf, | |
int | offset, | |||
time_t | unixdate, | |||
int | zone_offset | |||
) |
put a dos date into a buffer (time/date format) This takes GMT time and puts local time in the buffer
参照先 make_dos_date().
00201 { 00202 uint32_t x = make_dos_date(unixdate, zone_offset); 00203 SIVAL(buf,offset,x); 00204 }
void push_dos_date2 | ( | uint8_t * | buf, | |
int | offset, | |||
time_t | unixdate, | |||
int | zone_offset | |||
) |
put a dos date into a buffer (date/time format) This takes GMT time and puts local time in the buffer
参照先 make_dos_date().
00211 { 00212 uint32_t x; 00213 x = make_dos_date(unixdate, zone_offset); 00214 x = ((x&0xFFFF)<<16) | ((x&0xFFFF0000)>>16); 00215 SIVAL(buf,offset,x); 00216 }
void push_dos_date3 | ( | uint8_t * | buf, | |
int | offset, | |||
time_t | unixdate, | |||
int | zone_offset | |||
) |
put a dos 32 bit "unix like" date into a buffer.
This routine takes GMT and converts it to LOCAL time before putting it (most SMBs assume localtime for this sort of date)
参照先 null_time().
00224 { 00225 if (!null_time(unixdate)) { 00226 unixdate -= zone_offset; 00227 } 00228 SIVAL(buf,offset,unixdate); 00229 }
static void interpret_dos_date | ( | uint32_t | date, | |
int * | year, | |||
int * | month, | |||
int * | day, | |||
int * | hour, | |||
int * | minute, | |||
int * | second | |||
) | [static] |
参照元 make_unix_date()・pull_dos_date().
00235 { 00236 uint32_t p0,p1,p2,p3; 00237 00238 p0=date&0xFF; p1=((date&0xFF00)>>8)&0xFF; 00239 p2=((date&0xFF0000)>>16)&0xFF; p3=((date&0xFF000000)>>24)&0xFF; 00240 00241 *second = 2*(p0 & 0x1F); 00242 *minute = ((p0>>5)&0xFF) + ((p1&0x7)<<3); 00243 *hour = (p1>>3)&0xFF; 00244 *day = (p2&0x1F); 00245 *month = ((p2>>5)&0xFF) + ((p3&0x1)<<3) - 1; 00246 *year = ((p3>>1)&0xFF) + 80; 00247 }
time_t pull_dos_date | ( | const uint8_t * | date_ptr, | |
int | zone_offset | |||
) |
create a unix date (int GMT) from a dos date (which is actually in localtime)
参照先 interpret_dos_date().
参照元 pull_dos_date2().
00254 { 00255 uint32_t dos_date=0; 00256 struct tm t; 00257 time_t ret; 00258 00259 dos_date = IVAL(date_ptr,0); 00260 00261 if (dos_date == 0) return (time_t)0; 00262 00263 interpret_dos_date(dos_date,&t.tm_year,&t.tm_mon, 00264 &t.tm_mday,&t.tm_hour,&t.tm_min,&t.tm_sec); 00265 t.tm_isdst = -1; 00266 00267 ret = timegm(&t); 00268 00269 ret += zone_offset; 00270 00271 return ret; 00272 }
time_t pull_dos_date2 | ( | const uint8_t * | date_ptr, | |
int | zone_offset | |||
) |
like make_unix_date() but the words are reversed
参照先 pull_dos_date().
00278 { 00279 uint32_t x,x2; 00280 00281 x = IVAL(date_ptr,0); 00282 x2 = ((x&0xFFFF)<<16) | ((x&0xFFFF0000)>>16); 00283 SIVAL(&x,0,x2); 00284 00285 return pull_dos_date((const uint8_t *)&x, zone_offset); 00286 }
time_t pull_dos_date3 | ( | const uint8_t * | date_ptr, | |
int | zone_offset | |||
) |
create a unix GMT date from a dos date in 32 bit "unix like" format these generally arrive as localtimes, with corresponding DST
参照先 null_time()・t.
00293 { 00294 time_t t = (time_t)IVAL(date_ptr,0); 00295 if (!null_time(t)) { 00296 t += zone_offset; 00297 } 00298 return t; 00299 }
char* http_timestring | ( | time_t | t | ) |
参照先 buf・localtime().
参照元 ads_cleanup_expired_creds()・ads_krb5_mk_req()・cgi_setup()・change_oem_password()・display_sam_unk_info_13()・display_sam_unk_info_8()・display_sam_user_info_21()・generic_job_delete()・net_ads_info()・print_sam_info()・rpc_registry_enumerate_internal()・sam_account_ok()・winbindd_raw_kerberos_login().
00306 { 00307 static fstring buf; 00308 struct tm *tm = localtime(&t); 00309 00310 if (t == TIME_T_MAX) { 00311 slprintf(buf,sizeof(buf)-1,"never"); 00312 } else if (!tm) { 00313 slprintf(buf,sizeof(buf)-1,"%ld seconds since the Epoch",(long)t); 00314 } else { 00315 #ifndef HAVE_STRFTIME 00316 const char *asct = asctime(tm); 00317 fstrcpy(buf, asct ? asct : "unknown"); 00318 } 00319 if(buf[strlen(buf)-1] == '\n') { 00320 buf[strlen(buf)-1] = 0; 00321 #else /* !HAVE_STRFTIME */ 00322 strftime(buf, sizeof(buf)-1, "%a, %d %b %Y %H:%M:%S %Z", tm); 00323 #endif /* !HAVE_STRFTIME */ 00324 } 00325 return buf; 00326 }
char* timestring | ( | TALLOC_CTX * | mem_ctx, | |
time_t | t | |||
) |
Return the date and time as a string
参照先 localtime()・talloc_asprintf()・talloc_strdup().
参照元 ndr_print_time_t()・nt_time_string().
00333 { 00334 char *TimeBuf; 00335 char tempTime[80]; 00336 struct tm *tm; 00337 00338 tm = localtime(&t); 00339 if (!tm) { 00340 return talloc_asprintf(mem_ctx, 00341 "%ld seconds since the Epoch", 00342 (long)t); 00343 } 00344 00345 #ifdef HAVE_STRFTIME 00346 /* some versions of gcc complain about using %c. This is a bug 00347 in the gcc warning, not a bug in this code. See a recent 00348 strftime() manual page for details. 00349 */ 00350 strftime(tempTime,sizeof(tempTime)-1,"%c %Z",tm); 00351 TimeBuf = talloc_strdup(mem_ctx, tempTime); 00352 #else 00353 TimeBuf = talloc_strdup(mem_ctx, asctime(tm)); 00354 #endif 00355 00356 return TimeBuf; 00357 }
const char* nt_time_string | ( | TALLOC_CTX * | mem_ctx, | |
NTTIME | nt | |||
) |
return a talloced string representing a NTTIME for human consumption
参照先 nt_time_to_unix()・t・timestring().
参照元 ndr_print_NTTIME().
00363 { 00364 time_t t; 00365 if (nt == 0) { 00366 return "NTTIME(0)"; 00367 } 00368 t = nt_time_to_unix(nt); 00369 return timestring(mem_ctx, t); 00370 }
NTTIME nttime_from_string | ( | const char * | s | ) |
int64_t usec_time_diff | ( | struct timeval * | tv1, | |
struct timeval * | tv2 | |||
) |
return (tv1 - tv2) in microseconds
参照元 receive_message_or_smb()・smbldap_search_ext()・sys_select_intr()・timeout_until().
00385 { 00386 int64_t sec_diff = tv1->tv_sec - tv2->tv_sec; 00387 return (sec_diff * 1000000) + (int64_t)(tv1->tv_usec - tv2->tv_usec); 00388 }
struct timeval timeval_zero | ( | void | ) |
return a zero timeval
参照元 del_deferred_open_entry()・open_file_ntcreate()・timeval_until().
00395 { 00396 struct timeval tv; 00397 tv.tv_sec = 0; 00398 tv.tv_usec = 0; 00399 return tv; 00400 }
BOOL timeval_is_zero | ( | const struct timeval * | tv | ) |
return True if a timeval is zero
参照元 add_event_by_time()・blocking_locks_timeout_ms()・open_file_ntcreate()・process_blocking_lock_queue()・receive_message_or_smb().
struct timeval timeval_current | ( | void | ) |
return a timeval for the current time
参照先 GetTimeOfDay().
00414 { 00415 struct timeval tv; 00416 GetTimeOfDay(&tv); 00417 return tv; 00418 }
struct timeval timeval_set | ( | uint32_t | secs, | |
uint32_t | usecs | |||
) |
return a timeval struct with the given elements
参照元 add_ccache_to_list()・irix_oplock_msg_waiting()・krb5_ticket_gain_handler()・krb5_ticket_refresh_handler()・open_file_ntcreate()・schedule_defer_open().
00424 { 00425 struct timeval tv; 00426 tv.tv_sec = secs; 00427 tv.tv_usec = usecs; 00428 return tv; 00429 }
struct timeval timeval_add | ( | const struct timeval * | tv, | |
uint32_t | secs, | |||
uint32_t | usecs | |||
) |
return a timeval ofs microseconds after tv
参照元 timeval_current_ofs()・timeval_sum().
00437 { 00438 struct timeval tv2 = *tv; 00439 const unsigned int million = 1000000; 00440 tv2.tv_sec += secs; 00441 tv2.tv_usec += usecs; 00442 tv2.tv_sec += tv2.tv_usec / million; 00443 tv2.tv_usec = tv2.tv_usec % million; 00444 return tv2; 00445 }
struct timeval timeval_sum | ( | const struct timeval * | tv1, | |
const struct timeval * | tv2 | |||
) |
return the sum of two timeval structures
参照先 timeval_add().
参照元 add_idle_event()・idle_event_handler()・push_deferred_smb_message()・request_timed_out().
00452 { 00453 return timeval_add(tv1, tv2->tv_sec, tv2->tv_usec); 00454 }
struct timeval timeval_current_ofs | ( | uint32_t | secs, | |
uint32_t | usecs | |||
) |
return a timeval secs/usecs into the future
参照先 timeval_add()・timeval_current().
参照元 account_lockout_policy_handler()・add_ccache_to_list()・add_oplock_timeout_handler()・async_request_sent()・krb5_ticket_gain_handler()・push_blocking_lock_request()・set_domain_offline()・set_domain_online_request().
00460 { 00461 struct timeval tv = timeval_current(); 00462 return timeval_add(&tv, secs, usecs); 00463 }
int timeval_compare | ( | const struct timeval * | tv1, | |
const struct timeval * | tv2 | |||
) |
compare two timeval structures.
Return -1 if tv1 < tv2 Return 0 if tv1 == tv2 Return 1 if tv1 > tv2
参照元 add_event_by_time()・process_blocking_lock_queue()・request_timed_out()・run_events()・timeval_until().
00472 { 00473 if (tv1->tv_sec > tv2->tv_sec) return 1; 00474 if (tv1->tv_sec < tv2->tv_sec) return -1; 00475 if (tv1->tv_usec > tv2->tv_usec) return 1; 00476 if (tv1->tv_usec < tv2->tv_usec) return -1; 00477 return 0; 00478 }
BOOL timeval_expired | ( | const struct timeval * | tv | ) |
return True if a timer is in the past
参照先 timeval_current().
00484 { 00485 struct timeval tv2 = timeval_current(); 00486 if (tv2.tv_sec > tv->tv_sec) return True; 00487 if (tv2.tv_sec < tv->tv_sec) return False; 00488 return (tv2.tv_usec >= tv->tv_usec); 00489 }
double timeval_elapsed2 | ( | const struct timeval * | tv1, | |
const struct timeval * | tv2 | |||
) |
return the number of seconds elapsed between two times
参照元 timeval_elapsed().
00495 { 00496 return (tv2->tv_sec - tv1->tv_sec) + 00497 (tv2->tv_usec - tv1->tv_usec)*1.0e-6; 00498 }
double timeval_elapsed | ( | const struct timeval * | tv | ) |
return the number of seconds elapsed since a given time
参照先 timeval_current()・timeval_elapsed2().
00504 { 00505 struct timeval tv2 = timeval_current(); 00506 return timeval_elapsed2(tv, &tv2); 00507 }
struct timeval timeval_min | ( | const struct timeval * | tv1, | |
const struct timeval * | tv2 | |||
) |
return the lesser of two timevals
参照元 event_add_to_select_args()・process_loop().
00514 { 00515 if (tv1->tv_sec < tv2->tv_sec) return *tv1; 00516 if (tv1->tv_sec > tv2->tv_sec) return *tv2; 00517 if (tv1->tv_usec < tv2->tv_usec) return *tv1; 00518 return *tv2; 00519 }
struct timeval timeval_max | ( | const struct timeval * | tv1, | |
const struct timeval * | tv2 | |||
) |
struct timeval timeval_until | ( | const struct timeval * | tv1, | |
const struct timeval * | tv2 | |||
) |
return the difference between two timevals as a timeval if tv1 comes after tv2, then return a zero timeval (this is *tv2 - *tv1)
参照先 t・timeval_compare()・timeval_zero().
参照元 event_add_to_select_args()・get_timed_events_timeout().
00540 { 00541 struct timeval t; 00542 if (timeval_compare(tv1, tv2) >= 0) { 00543 return timeval_zero(); 00544 } 00545 t.tv_sec = tv2->tv_sec - tv1->tv_sec; 00546 if (tv1->tv_usec > tv2->tv_usec) { 00547 t.tv_sec--; 00548 t.tv_usec = 1000000 - (tv1->tv_usec - tv2->tv_usec); 00549 } else { 00550 t.tv_usec = tv2->tv_usec - tv1->tv_usec; 00551 } 00552 return t; 00553 }
NTTIME timeval_to_nttime | ( | const struct timeval * | tv | ) |
uint32 convert_time_t_to_uint32 | ( | time_t | t | ) |
参照元 init_buffer_from_sam_v3()・print_sam_info().
00571 { 00572 #if (defined(SIZEOF_TIME_T) && (SIZEOF_TIME_T == 8)) 00573 /* time_t is 64-bit. */ 00574 if (t == 0x8000000000000000LL) { 00575 return 0x80000000; 00576 } else if (t == 0x7FFFFFFFFFFFFFFFLL) { 00577 return 0x7FFFFFFF; 00578 } 00579 #endif 00580 return (uint32)t; 00581 }
time_t convert_uint32_to_time_t | ( | uint32 | u | ) |
参照元 init_sam_from_buffer_v3()・pdb_update_autolock_flag()・pdb_update_bad_password_count().
00584 { 00585 #if (defined(SIZEOF_TIME_T) && (SIZEOF_TIME_T == 8)) 00586 /* time_t is 64-bit. */ 00587 if (u == 0x80000000) { 00588 return (time_t)0x8000000000000000LL; 00589 } else if (u == 0x7FFFFFFF) { 00590 return (time_t)0x7FFFFFFFFFFFFFFFLL; 00591 } 00592 #endif 00593 return (time_t)u; 00594 }
static int tm_diff | ( | struct tm * | a, | |
struct tm * | b | |||
) | [static] |
参照元 get_time_zone().
00601 { 00602 int ay = a->tm_year + (1900 - 1); 00603 int by = b->tm_year + (1900 - 1); 00604 int intervening_leap_days = 00605 (ay/4 - by/4) - (ay/100 - by/100) + (ay/400 - by/400); 00606 int years = ay - by; 00607 int days = 365*years + intervening_leap_days + (a->tm_yday - b->tm_yday); 00608 int hours = 24*days + (a->tm_hour - b->tm_hour); 00609 int minutes = 60*hours + (a->tm_min - b->tm_min); 00610 int seconds = 60*minutes + (a->tm_sec - b->tm_sec); 00611 00612 return seconds; 00613 }
int get_time_zone | ( | time_t | t | ) |
参照先 extra_time_offset・gmtime()・localtime()・tm_diff().
参照元 _srv_net_remote_tod()・api_NetRemoteTOD()・cli_negprot()・fill_printjob_info()・set_server_zone_offset().
00622 { 00623 struct tm *tm = gmtime(&t); 00624 struct tm tm_utc; 00625 if (!tm) 00626 return 0; 00627 tm_utc = *tm; 00628 tm = localtime(&t); 00629 if (!tm) 00630 return 0; 00631 return tm_diff(&tm_utc,tm)+60*extra_time_offset; 00632 }
time_t generalized_to_unix_time | ( | const char * | str | ) |
00649 { 00650 struct tm tm; 00651 00652 ZERO_STRUCT(tm); 00653 00654 if (sscanf(str, "%4d%2d%2d%2d%2d%2d", 00655 &tm.tm_year, &tm.tm_mon, &tm.tm_mday, 00656 &tm.tm_hour, &tm.tm_min, &tm.tm_sec) != 6) { 00657 return 0; 00658 } 00659 tm.tm_year -= 1900; 00660 tm.tm_mon -= 1; 00661 00662 return timegm(&tm); 00663 }
int get_server_zone_offset | ( | void | ) |
int set_server_zone_offset | ( | time_t | t | ) |
参照先 get_time_zone()・server_zone_offset.
参照元 reply_lanman1()・reply_lanman2()・reply_nt1()・TimeInit().
00682 { 00683 server_zone_offset = get_time_zone(t); 00684 return server_zone_offset; 00685 }
char* current_timestring | ( | BOOL | hires | ) |
参照先 GetTimeOfDay()・localtime()・t・tp.
参照元 alloc_sub_basic()・change_trust_account_password()・cmd_spoolss_setprinterdata()・dbghdr()・main()・trust_pw_change_and_store_it()・write_config().
00692 { 00693 static fstring TimeBuf; 00694 struct timeval tp; 00695 time_t t; 00696 struct tm *tm; 00697 00698 if (hires) { 00699 GetTimeOfDay(&tp); 00700 t = (time_t)tp.tv_sec; 00701 } else { 00702 t = time(NULL); 00703 } 00704 tm = localtime(&t); 00705 if (!tm) { 00706 if (hires) { 00707 slprintf(TimeBuf, 00708 sizeof(TimeBuf)-1, 00709 "%ld.%06ld seconds since the Epoch", 00710 (long)tp.tv_sec, 00711 (long)tp.tv_usec); 00712 } else { 00713 slprintf(TimeBuf, 00714 sizeof(TimeBuf)-1, 00715 "%ld seconds since the Epoch", 00716 (long)t); 00717 } 00718 } else { 00719 #ifdef HAVE_STRFTIME 00720 if (hires) { 00721 strftime(TimeBuf,sizeof(TimeBuf)-1,"%Y/%m/%d %H:%M:%S",tm); 00722 slprintf(TimeBuf+strlen(TimeBuf), 00723 sizeof(TimeBuf)-1 - strlen(TimeBuf), 00724 ".%06ld", 00725 (long)tp.tv_usec); 00726 } else { 00727 strftime(TimeBuf,sizeof(TimeBuf)-1,"%Y/%m/%d %H:%M:%S",tm); 00728 } 00729 #else 00730 if (hires) { 00731 const char *asct = asctime(tm); 00732 slprintf(TimeBuf, 00733 sizeof(TimeBuf)-1, 00734 "%s.%06ld", 00735 asct ? asct : "unknown", 00736 (long)tp.tv_usec); 00737 } else { 00738 const char *asct = asctime(tm); 00739 fstrcpy(TimeBuf, asct ? asct : "unknown"); 00740 } 00741 #endif 00742 } 00743 return(TimeBuf); 00744 }
static void put_dos_date | ( | char * | buf, | |
int | offset, | |||
time_t | unixdate, | |||
int | zone_offset | |||
) | [static] |
参照先 make_dos_date().
参照元 cli_put_dos_date()・srv_put_dos_date().
00753 { 00754 uint32 x = make_dos_date(unixdate, zone_offset); 00755 SIVAL(buf,offset,x); 00756 }
static void put_dos_date2 | ( | char * | buf, | |
int | offset, | |||
time_t | unixdate, | |||
int | zone_offset | |||
) | [static] |
参照先 make_dos_date().
参照元 cli_put_dos_date2()・srv_put_dos_date2().
00764 { 00765 uint32 x = make_dos_date(unixdate, zone_offset); 00766 x = ((x&0xFFFF)<<16) | ((x&0xFFFF0000)>>16); 00767 SIVAL(buf,offset,x); 00768 }
static void put_dos_date3 | ( | char * | buf, | |
int | offset, | |||
time_t | unixdate, | |||
int | zone_offset | |||
) | [static] |
参照先 null_mtime().
参照元 cli_put_dos_date3()・srv_put_dos_date3().
00777 { 00778 if (!null_mtime(unixdate)) { 00779 unixdate -= zone_offset; 00780 } 00781 SIVAL(buf,offset,unixdate); 00782 }
void srv_put_dos_date | ( | char * | buf, | |
int | offset, | |||
time_t | unixdate | |||
) |
参照先 put_dos_date()・server_zone_offset.
参照元 make_dir_struct()・reply_lanman1()・reply_lanman2().
00790 { 00791 put_dos_date(buf, offset, unixdate, server_zone_offset); 00792 }
void srv_put_dos_date2 | ( | char * | buf, | |
int | offset, | |||
time_t | unixdate | |||
) |
参照先 put_dos_date2()・server_zone_offset.
参照元 call_trans2open()・call_trans2qfilepathinfo()・get_lanman2_dir_entry()・reply_getattrE()・reply_printqueue().
00795 { 00796 put_dos_date2(buf, offset, unixdate, server_zone_offset); 00797 }
void srv_put_dos_date3 | ( | char * | buf, | |
int | offset, | |||
time_t | unixdate | |||
) |
参照先 put_dos_date3()・server_zone_offset.
参照元 api_NetRemoteTOD()・reply_getatr()・reply_open()・reply_open_and_X()・reply_open_pipe_and_X().
00800 { 00801 put_dos_date3(buf, offset, unixdate, server_zone_offset); 00802 }
void put_long_date_timespec | ( | char * | p, | |
struct timespec | ts | |||
) |
参照先 unix_timespec_to_nt_time().
参照元 call_nt_transact_create()・call_trans2qfilepathinfo()・get_lanman2_dir_entry()・put_long_date()・reply_ntcreate_and_X()・store_file_unix_basic()・store_file_unix_basic_info2().
00810 { 00811 NTTIME nt; 00812 unix_timespec_to_nt_time(&nt, ts); 00813 SIVAL(p, 0, nt & 0xFFFFFFFF); 00814 SIVAL(p, 4, nt >> 32); 00815 }
void put_long_date | ( | char * | p, | |
time_t | t | |||
) |
参照元 cli_setpathinfo()・NTLMv2_generate_client_data()・reply_nt1().
00818 { 00819 struct timespec ts; 00820 ts.tv_sec = t; 00821 ts.tv_nsec = 0; 00822 put_long_date_timespec(p, ts); 00823 }
time_t get_create_time | ( | const SMB_STRUCT_STAT * | st, | |
BOOL | fake_dirs | |||
) |
参照元 get_create_timespec()・reply_getattrE().
00831 { 00832 time_t ret, ret1; 00833 00834 if(S_ISDIR(st->st_mode) && fake_dirs) { 00835 return (time_t)315493200L; /* 1/1/1980 */ 00836 } 00837 00838 ret = MIN(st->st_ctime, st->st_mtime); 00839 ret1 = MIN(ret, st->st_atime); 00840 00841 if(ret1 != (time_t)0) { 00842 return ret1; 00843 } 00844 00845 /* 00846 * One of ctime, mtime or atime was zero (probably atime). 00847 * Just return MIN(ctime, mtime). 00848 */ 00849 return ret; 00850 }
struct timespec get_create_timespec | ( | const SMB_STRUCT_STAT * | st, | |
BOOL | fake_dirs | |||
) |
参照先 get_create_time().
参照元 call_nt_transact_create()・call_trans2qfilepathinfo()・get_lanman2_dir_entry()・reply_ntcreate_and_X()・store_file_unix_basic_info2().
00853 { 00854 struct timespec ts; 00855 ts.tv_sec = get_create_time(st, fake_dirs); 00856 ts.tv_nsec = 0; 00857 return ts; 00858 }
struct timespec get_atimespec | ( | const SMB_STRUCT_STAT * | pst | ) |
参照元 call_nt_transact_create()・call_trans2qfilepathinfo()・get_lanman2_dir_entry()・reply_mknew()・reply_ntcreate_and_X()・smb_set_file_time()・smb_set_file_unix_basic()・store_file_unix_basic().
00865 { 00866 #if !defined(HAVE_STAT_HIRES_TIMESTAMPS) 00867 struct timespec ret; 00868 00869 /* Old system - no ns timestamp. */ 00870 ret.tv_sec = pst->st_atime; 00871 ret.tv_nsec = 0; 00872 return ret; 00873 #else 00874 #if defined(HAVE_STAT_ST_ATIM) 00875 return pst->st_atim; 00876 #elif defined(HAVE_STAT_ST_ATIMENSEC) 00877 struct timespec ret; 00878 ret.tv_sec = pst->st_atime; 00879 ret.tv_nsec = pst->st_atimensec; 00880 return ret; 00881 #else 00882 #error CONFIGURE_ERROR_IN_DETECTING_TIMESPEC_IN_STAT 00883 #endif 00884 #endif 00885 }
void set_atimespec | ( | SMB_STRUCT_STAT * | pst, | |
struct timespec | ts | |||
) |
参照元 cli_qpathinfo_basic()・cli_unix_stat()・smbc_fstat_ctx()・smbc_stat_ctx().
00888 { 00889 #if !defined(HAVE_STAT_HIRES_TIMESTAMPS) 00890 /* Old system - no ns timestamp. */ 00891 pst->st_atime = ts.tv_sec; 00892 #else 00893 #if defined(HAVE_STAT_ST_ATIM) 00894 pst->st_atim = ts; 00895 #elif defined(HAVE_STAT_ST_ATIMENSEC) 00896 pst->st_atime = ts.tv_sec; 00897 pst->st_atimensec = ts.tv_nsec 00898 #else 00899 #error CONFIGURE_ERROR_IN_DETECTING_TIMESPEC_IN_STAT 00900 #endif 00901 #endif 00902 }
struct timespec get_mtimespec | ( | const SMB_STRUCT_STAT * | pst | ) |
参照元 call_nt_transact_create()・call_trans2qfilepathinfo()・copy_file()・copy_internals()・get_lanman2_dir_entry()・recycle_do_touch()・reply_ntcreate_and_X()・smb_set_file_time()・smb_set_file_unix_basic()・store_file_unix_basic().
00905 { 00906 #if !defined(HAVE_STAT_HIRES_TIMESTAMPS) 00907 struct timespec ret; 00908 00909 /* Old system - no ns timestamp. */ 00910 ret.tv_sec = pst->st_mtime; 00911 ret.tv_nsec = 0; 00912 return ret; 00913 #else 00914 #if defined(HAVE_STAT_ST_MTIM) 00915 return pst->st_mtim; 00916 #elif defined(HAVE_STAT_ST_MTIMENSEC) 00917 struct timespec ret; 00918 ret.tv_sec = pst->st_mtime; 00919 ret.tv_nsec = pst->st_mtimensec; 00920 return ret; 00921 #else 00922 #error CONFIGURE_ERROR_IN_DETECTING_TIMESPEC_IN_STAT 00923 #endif 00924 #endif 00925 }
void set_mtimespec | ( | SMB_STRUCT_STAT * | pst, | |
struct timespec | ts | |||
) |
参照元 call_trans2setfilepathinfo()・cli_qpathinfo_basic()・cli_unix_stat()・smbc_fstat_ctx()・smbc_stat_ctx().
00928 { 00929 #if !defined(HAVE_STAT_HIRES_TIMESTAMPS) 00930 /* Old system - no ns timestamp. */ 00931 pst->st_mtime = ts.tv_sec; 00932 #else 00933 #if defined(HAVE_STAT_ST_MTIM) 00934 pst->st_mtim = ts; 00935 #elif defined(HAVE_STAT_ST_MTIMENSEC) 00936 pst->st_mtime = ts.tv_sec; 00937 pst->st_mtimensec = ts.tv_nsec 00938 #else 00939 #error CONFIGURE_ERROR_IN_DETECTING_TIMESPEC_IN_STAT 00940 #endif 00941 #endif 00942 }
struct timespec get_ctimespec | ( | const SMB_STRUCT_STAT * | pst | ) |
00945 { 00946 #if !defined(HAVE_STAT_HIRES_TIMESTAMPS) 00947 struct timespec ret; 00948 00949 /* Old system - no ns timestamp. */ 00950 ret.tv_sec = pst->st_ctime; 00951 ret.tv_nsec = 0; 00952 return ret; 00953 #else 00954 #if defined(HAVE_STAT_ST_CTIM) 00955 return pst->st_ctim; 00956 #elif defined(HAVE_STAT_ST_CTIMENSEC) 00957 struct timespec ret; 00958 ret.tv_sec = pst->st_ctime; 00959 ret.tv_nsec = pst->st_ctimensec; 00960 return ret; 00961 #else 00962 #error CONFIGURE_ERROR_IN_DETECTING_TIMESPEC_IN_STAT 00963 #endif 00964 #endif 00965 }
void set_ctimespec | ( | SMB_STRUCT_STAT * | pst, | |
struct timespec | ts | |||
) |
参照元 cli_qpathinfo_basic()・cli_unix_stat()・smbc_fstat_ctx()・smbc_stat_ctx().
00968 { 00969 #if !defined(HAVE_STAT_HIRES_TIMESTAMPS) 00970 /* Old system - no ns timestamp. */ 00971 pst->st_ctime = ts.tv_sec; 00972 #else 00973 #if defined(HAVE_STAT_ST_CTIM) 00974 pst->st_ctim = ts; 00975 #elif defined(HAVE_STAT_ST_CTIMENSEC) 00976 pst->st_ctime = ts.tv_sec; 00977 pst->st_ctimensec = ts.tv_nsec 00978 #else 00979 #error CONFIGURE_ERROR_IN_DETECTING_TIMESPEC_IN_STAT 00980 #endif 00981 #endif 00982 }
void dos_filetime_timespec | ( | struct timespec * | tsp | ) |
static time_t make_unix_date | ( | const void * | date_ptr, | |
int | zone_offset | |||
) | [static] |
参照先 interpret_dos_date().
参照元 cli_make_unix_date()・make_unix_date2()・srv_make_unix_date().
00996 { 00997 uint32 dos_date=0; 00998 struct tm t; 00999 time_t ret; 01000 01001 dos_date = IVAL(date_ptr,0); 01002 01003 if (dos_date == 0) { 01004 return 0; 01005 } 01006 01007 interpret_dos_date(dos_date,&t.tm_year,&t.tm_mon, 01008 &t.tm_mday,&t.tm_hour,&t.tm_min,&t.tm_sec); 01009 t.tm_isdst = -1; 01010 01011 ret = timegm(&t); 01012 01013 ret += zone_offset; 01014 01015 return(ret); 01016 }
static time_t make_unix_date2 | ( | const void * | date_ptr, | |
int | zone_offset | |||
) | [static] |
参照先 make_unix_date().
参照元 cli_make_unix_date2()・srv_make_unix_date2().
01023 { 01024 uint32 x,x2; 01025 01026 x = IVAL(date_ptr,0); 01027 x2 = ((x&0xFFFF)<<16) | ((x&0xFFFF0000)>>16); 01028 SIVAL(&x,0,x2); 01029 01030 return(make_unix_date((const void *)&x, zone_offset)); 01031 }
static time_t make_unix_date3 | ( | const void * | date_ptr, | |
int | zone_offset | |||
) | [static] |
参照先 null_mtime()・t.
参照元 call_trans2open()・cli_make_unix_date3()・reply_open_and_X()・srv_make_unix_date3().
01039 { 01040 time_t t = (time_t)IVAL(date_ptr,0); 01041 if (!null_mtime(t)) { 01042 t += zone_offset; 01043 } 01044 return(t); 01045 }
time_t srv_make_unix_date | ( | const void * | date_ptr | ) |
参照先 make_unix_date()・server_zone_offset.
01048 { 01049 return make_unix_date(date_ptr, server_zone_offset); 01050 }
time_t srv_make_unix_date2 | ( | const void * | date_ptr | ) |
参照先 make_unix_date2()・server_zone_offset.
参照元 reply_setattrE()・smb_set_info_standard().
01053 { 01054 return make_unix_date2(date_ptr, server_zone_offset); 01055 }
time_t srv_make_unix_date3 | ( | const void * | date_ptr | ) |
参照先 make_unix_date3()・server_zone_offset.
参照元 reply_close()・reply_mknew()・reply_setatr()・reply_writeclose().
01058 { 01059 return make_unix_date3(date_ptr, server_zone_offset); 01060 }
time_t convert_timespec_to_time_t | ( | struct timespec | ts | ) |
参照元 cacl_get()・call_trans2qfilepathinfo()・dos_attr_query()・get_lanman2_dir_entry()・nt_time_to_unix()・smb_set_file_time()・vfswrap_ntimes().
01063 { 01064 /* 1 ns == 1,000,000,000 - one thousand millionths of a second. 01065 increment if it's greater than 500 millionth of a second. */ 01066 if (ts.tv_nsec > 500000000) { 01067 return ts.tv_sec + 1; 01068 } 01069 return ts.tv_sec; 01070 }
struct timespec convert_time_t_to_timespec | ( | time_t | t | ) |
参照先 t.
参照元 cmd_utime()・interpret_long_filename()・reply_close()・reply_mknew()・reply_setatr()・reply_setattrE()・reply_writeclose()・smb_set_info_standard()・smbc_fstat_ctx()・smbc_getatr()・writetarheader().
01073 { 01074 struct timespec ts; 01075 ts.tv_sec = t; 01076 ts.tv_nsec = 0; 01077 return ts; 01078 }
struct timespec convert_timeval_to_timespec | ( | const struct timeval | tv | ) |
struct timeval convert_timespec_to_timeval | ( | const struct timespec | ts | ) |
参照元 vfswrap_ntimes().
01097 { 01098 struct timeval tv; 01099 tv.tv_sec = ts.tv_sec; 01100 tv.tv_usec = ts.tv_nsec / 1000; 01101 return tv; 01102 }
struct timespec timespec_current | ( | void | ) |
参照先 GetTimeOfDay().
参照元 real_write_file()・recycle_do_touch()・smb_set_file_allocation_info().
01109 { 01110 struct timeval tv; 01111 struct timespec ts; 01112 GetTimeOfDay(&tv); 01113 ts.tv_sec = tv.tv_sec; 01114 ts.tv_nsec = tv.tv_usec * 1000; 01115 return ts; 01116 }
struct timespec timespec_min | ( | const struct timespec * | ts1, | |
const struct timespec * | ts2 | |||
) |
参照元 smb_set_file_basic_info().
01124 { 01125 if (ts1->tv_sec < ts2->tv_sec) return *ts1; 01126 if (ts1->tv_sec > ts2->tv_sec) return *ts2; 01127 if (ts1->tv_nsec < ts2->tv_nsec) return *ts1; 01128 return *ts2; 01129 }
int timespec_compare | ( | const struct timespec * | ts1, | |
const struct timespec * | ts2 | |||
) |
参照元 smb_set_file_basic_info()・smb_set_file_time().
01139 { 01140 if (ts1->tv_sec > ts2->tv_sec) return 1; 01141 if (ts1->tv_sec < ts2->tv_sec) return -1; 01142 if (ts1->tv_nsec > ts2->tv_nsec) return 1; 01143 if (ts1->tv_nsec < ts2->tv_nsec) return -1; 01144 return 0; 01145 }
struct timespec interpret_long_date | ( | const char * | p | ) |
参照先 nt_time_to_unix_timespec().
参照元 cli_get_fs_volume_info()・cli_negprot()・cli_qfileinfo()・cli_qpathinfo2()・cli_qpathinfo_basic()・cli_unix_stat()・interpret_long_filename()・smb_set_file_basic_info()・smb_set_file_unix_basic().
01154 { 01155 NTTIME nt; 01156 nt = IVAL(p,0) + ((uint64_t)IVAL(p,4) << 32); 01157 if (nt == (uint64_t)-1) { 01158 struct timespec ret; 01159 ret.tv_sec = (time_t)-1; 01160 ret.tv_nsec = 0; 01161 return ret; 01162 } 01163 return nt_time_to_unix_timespec(&nt); 01164 }
void cli_put_dos_date | ( | struct cli_state * | cli, | |
char * | buf, | |||
int | offset, | |||
time_t | unixdate | |||
) |
参照先 cli・put_dos_date()・cli_state::serverzone.
01171 { 01172 put_dos_date(buf, offset, unixdate, cli->serverzone); 01173 }
void cli_put_dos_date2 | ( | struct cli_state * | cli, | |
char * | buf, | |||
int | offset, | |||
time_t | unixdate | |||
) |
参照先 cli・put_dos_date2()・cli_state::serverzone.
参照元 cli_setattrE().
01176 { 01177 put_dos_date2(buf, offset, unixdate, cli->serverzone); 01178 }
void cli_put_dos_date3 | ( | struct cli_state * | cli, | |
char * | buf, | |||
int | offset, | |||
time_t | unixdate | |||
) |
参照先 cli・put_dos_date3()・cli_state::serverzone.
参照元 cli_setatr().
01181 { 01182 put_dos_date3(buf, offset, unixdate, cli->serverzone); 01183 }
time_t cli_make_unix_date | ( | struct cli_state * | cli, | |
void * | date_ptr | |||
) |
参照先 cli・make_unix_date()・cli_state::serverzone.
参照元 cli_negprot()・cli_qpathinfo()・interpret_short_filename().
01186 { 01187 return make_unix_date(date_ptr, cli->serverzone); 01188 }
time_t cli_make_unix_date2 | ( | struct cli_state * | cli, | |
void * | date_ptr | |||
) |
参照先 cli・make_unix_date2()・cli_state::serverzone.
参照元 cli_getattrE()・cli_qpathinfo()・interpret_long_filename().
01191 { 01192 return make_unix_date2(date_ptr, cli->serverzone); 01193 }
time_t cli_make_unix_date3 | ( | struct cli_state * | cli, | |
void * | date_ptr | |||
) |
参照先 cli・make_unix_date3()・cli_state::serverzone.
参照元 cli_getatr()・cli_print_queue().
01196 { 01197 return make_unix_date3(date_ptr, cli->serverzone); 01198 }
struct timespec nt_time_to_unix_timespec | ( | NTTIME * | nt | ) |
参照元 interpret_long_date()・nt_time_to_unix().
01202 { 01203 int64 d; 01204 struct timespec ret; 01205 01206 if (*nt == 0 || *nt == (int64)-1) { 01207 ret.tv_sec = 0; 01208 ret.tv_nsec = 0; 01209 return ret; 01210 } 01211 01212 d = (int64)*nt; 01213 /* d is now in 100ns units, since jan 1st 1601". 01214 Save off the ns fraction. */ 01215 01216 /* 01217 * Take the last seven decimal digits and multiply by 100. 01218 * to convert from 100ns units to 1ns units. 01219 */ 01220 ret.tv_nsec = (long) ((d % (1000 * 1000 * 10)) * 100); 01221 01222 /* Convert to seconds */ 01223 d /= 1000*1000*10; 01224 01225 /* Now adjust by 369 years to make the secs since 1970 */ 01226 d -= TIME_FIXUP_CONSTANT_INT; 01227 01228 if (d <= (int64)TIME_T_MIN) { 01229 ret.tv_sec = TIME_T_MIN; 01230 ret.tv_nsec = 0; 01231 return ret; 01232 } 01233 01234 if (d >= (int64)TIME_T_MAX) { 01235 ret.tv_sec = TIME_T_MAX; 01236 ret.tv_nsec = 0; 01237 return ret; 01238 } 01239 01240 ret.tv_sec = (time_t)d; 01241 return ret; 01242 }
void TimeInit | ( | void | ) |
参照先 GetTimeOfDay()・server_zone_offset・set_server_zone_offset()・start_time_hires.
参照元 main()・nss_wins_init().
01259 { 01260 set_server_zone_offset(time(NULL)); 01261 01262 DEBUG(4,("TimeInit: Serverzone is %d\n", server_zone_offset)); 01263 01264 /* Save the start time of this process. */ 01265 if (start_time_hires.tv_sec == 0 && start_time_hires.tv_usec == 0) { 01266 GetTimeOfDay(&start_time_hires); 01267 } 01268 }
void get_process_uptime | ( | struct timeval * | ret_time | ) |
参照先 GetTimeOfDay()・start_time_hires.
参照元 rev_changeid().
01277 { 01278 struct timeval time_now_hires; 01279 01280 GetTimeOfDay(&time_now_hires); 01281 ret_time->tv_sec = time_now_hires.tv_sec - start_time_hires.tv_sec; 01282 if (time_now_hires.tv_usec < start_time_hires.tv_usec) { 01283 ret_time->tv_sec -= 1; 01284 ret_time->tv_usec = 1000000 + (time_now_hires.tv_usec - start_time_hires.tv_usec); 01285 } else { 01286 ret_time->tv_usec = time_now_hires.tv_usec - start_time_hires.tv_usec; 01287 } 01288 }
time_t nt_time_to_unix_abs | ( | const NTTIME * | nt | ) |
参照元 _samr_set_dom_info()・account_set_lockduration()・account_set_maxpwage()・account_set_minpwage()・account_set_resetduration()・account_show()・display_sam_unk_info_2()・display_sam_unk_info_3()・fillup_password_policy()・uint64s_nt_time_to_unix_abs()・winbindd_dual_pam_chauthtok().
01300 { 01301 uint64 d; 01302 01303 if (*nt == 0) { 01304 return (time_t)0; 01305 } 01306 01307 if (*nt == (uint64)-1) { 01308 return (time_t)-1; 01309 } 01310 01311 if (*nt == NTTIME_INFINITY) { 01312 return (time_t)-1; 01313 } 01314 01315 /* reverse the time */ 01316 /* it's a negative value, turn it to positive */ 01317 d=~*nt; 01318 01319 d += 1000*1000*10/2; 01320 d /= 1000*1000*10; 01321 01322 if (!(TIME_T_MIN <= ((time_t)d) && ((time_t)d) <= TIME_T_MAX)) { 01323 return (time_t)0; 01324 } 01325 01326 return (time_t)d; 01327 }
void unix_timespec_to_nt_time | ( | NTTIME * | nt, | |
struct timespec | ts | |||
) |
01334 { 01335 uint64 d; 01336 01337 if (ts.tv_sec ==0 && ts.tv_nsec == 0) { 01338 *nt = 0; 01339 return; 01340 } 01341 if (ts.tv_sec == TIME_T_MAX) { 01342 *nt = 0x7fffffffffffffffLL; 01343 return; 01344 } 01345 if (ts.tv_sec == (time_t)-1) { 01346 *nt = (uint64)-1; 01347 return; 01348 } 01349 01350 d = ts.tv_sec; 01351 d += TIME_FIXUP_CONSTANT_INT; 01352 d *= 1000*1000*10; 01353 /* d is now in 100ns units. */ 01354 d += (ts.tv_nsec / 100); 01355 01356 *nt = d; 01357 }
void unix_to_nt_time_abs | ( | NTTIME * | nt, | |
time_t | t | |||
) |
参照元 _samr_chgpasswd_user3()・_samr_query_domain_info()・account_set_lockduration()・account_set_maxpwage()・account_set_minpwage()・account_set_resetduration()・init_sam_user_info21A()・password_policy().
01368 { 01369 double d; 01370 01371 if (t==0) { 01372 *nt = 0; 01373 return; 01374 } 01375 01376 if (t == TIME_T_MAX) { 01377 *nt = 0x7fffffffffffffffLL; 01378 return; 01379 } 01380 01381 if (t == (time_t)-1) { 01382 /* that's what NT uses for infinite */ 01383 *nt = NTTIME_INFINITY; 01384 return; 01385 } 01386 01387 d = (double)(t); 01388 d *= 1.0e7; 01389 01390 *nt = d; 01391 01392 /* convert to a negative value */ 01393 *nt=~*nt; 01394 }
BOOL null_mtime | ( | time_t | mtime | ) |
参照元 make_unix_date3()・put_dos_date3().
01402 { 01403 if (mtime == 0 || mtime == (time_t)0xFFFFFFFF || mtime == (time_t)-1) 01404 return(True); 01405 return(False); 01406 }
const char* time_to_asc | ( | const time_t | t | ) |
参照先 localtime().
参照元 cmd_newer()・display_finfo()・display_stat()・print_share_mode()・show_share()・smb_set_file_time()・traverse_fn1()・tstring()・writetarheader().
01414 { 01415 const char *asct; 01416 struct tm *lt = localtime(&t); 01417 01418 if (!lt) { 01419 return "unknown time"; 01420 } 01421 01422 asct = asctime(lt); 01423 if (!asct) { 01424 return "unknown time"; 01425 } 01426 return asct; 01427 }
const char* display_time | ( | NTTIME | nttime | ) |
参照先 fstr_sprintf()・string.
参照元 display_domain_info()・display_sam_unk_info_1()・display_sam_unk_info_12().
01430 { 01431 static fstring string; 01432 01433 float high; 01434 float low; 01435 int sec; 01436 int days, hours, mins, secs; 01437 01438 if (nttime==0) 01439 return "Now"; 01440 01441 if (nttime==NTTIME_INFINITY) 01442 return "Never"; 01443 01444 high = 65536; 01445 high = high/10000; 01446 high = high*65536; 01447 high = high/1000; 01448 high = high * (~(nttime >> 32)); 01449 01450 low = ~(nttime & 0xFFFFFFFF); 01451 low = low/(1000*1000*10); 01452 01453 sec=high+low; 01454 01455 days=sec/(60*60*24); 01456 hours=(sec - (days*60*60*24)) / (60*60); 01457 mins=(sec - (days*60*60*24) - (hours*60*60) ) / 60; 01458 secs=sec - (days*60*60*24) - (hours*60*60) - (mins*60); 01459 01460 fstr_sprintf(string, "%u days, %u hours, %u minutes, %u seconds", days, hours, mins, secs); 01461 return (string); 01462 }
参照元 account_show().
01465 { 01466 if (*nt == 0x7FFFFFFFFFFFFFFFLL) { 01467 return False; 01468 } 01469 01470 if (*nt == NTTIME_INFINITY) { 01471 return False; 01472 } 01473 01474 return True; 01475 }
int extra_time_offset = 0 |
int server_zone_offset [static] |
struct timeval start_time_hires [static] |