Ignore:
Timestamp:
Nov 24, 2016, 1:14:11 PM (9 years ago)
Author:
Silvan Scherrer
Message:

Samba Server: update vendor to version 4.4.3

File:
1 edited

Legend:

Unmodified
Added
Removed
  • vendor/current/lib/util/time.h

    r740 r988  
    2525#define _SAMBA_TIME_H_
    2626
    27 #ifndef _PUBLIC_
    28 #define _PUBLIC_
    29 #endif
     27#include <stdbool.h>
     28#include <stdint.h>
     29#include <talloc.h>
    3030
    3131#ifndef TIME_T_MIN
     
    4949 External access to time_t_min and time_t_max.
    5050**/
    51 _PUBLIC_ time_t get_time_t_max(void);
     51time_t get_time_t_max(void);
    5252
    5353/**
    5454a gettimeofday wrapper
    5555**/
    56 _PUBLIC_ void GetTimeOfDay(struct timeval *tval);
     56void GetTimeOfDay(struct timeval *tval);
    5757
    5858/**
    5959a wrapper to preferably get the monotonic time
    6060**/
    61 _PUBLIC_ void clock_gettime_mono(struct timespec *tp);
     61void clock_gettime_mono(struct timespec *tp);
    6262
    6363/**
    6464a wrapper to preferably get the monotonic time in s
    6565**/
    66 _PUBLIC_ time_t time_mono(time_t *t);
     66time_t time_mono(time_t *t);
    6767
    6868/**
     
    7070It's originally in "100ns units since jan 1st 1601"
    7171**/
    72 _PUBLIC_ time_t nt_time_to_unix(NTTIME nt);
     72time_t nt_time_to_unix(NTTIME nt);
    7373
    7474/**
     
    7676This takes GMT as input
    7777**/
    78 _PUBLIC_ void unix_to_nt_time(NTTIME *nt, time_t t);
     78void unix_to_nt_time(NTTIME *nt, time_t t);
    7979
    8080/**
    8181check if it's a null unix time
    8282**/
    83 _PUBLIC_ bool null_time(time_t t);
     83bool null_time(time_t t);
    8484
    8585/**
    8686check if it's a null NTTIME
    8787**/
    88 _PUBLIC_ bool null_nttime(NTTIME t);
     88bool null_nttime(NTTIME t);
    8989
    9090/**
     
    9292This takes GMT time and puts local time in the buffer
    9393**/
    94 _PUBLIC_ void push_dos_date(uint8_t *buf, int offset, time_t unixdate, int zone_offset);
     94void push_dos_date(uint8_t *buf, int offset, time_t unixdate, int zone_offset);
    9595
    9696/**
     
    9898This takes GMT time and puts local time in the buffer
    9999**/
    100 _PUBLIC_ void push_dos_date2(uint8_t *buf,int offset,time_t unixdate, int zone_offset);
     100void push_dos_date2(uint8_t *buf,int offset,time_t unixdate, int zone_offset);
    101101
    102102/**
     
    105105localtime for this sort of date)
    106106**/
    107 _PUBLIC_ void push_dos_date3(uint8_t *buf,int offset,time_t unixdate, int zone_offset);
     107void push_dos_date3(uint8_t *buf,int offset,time_t unixdate, int zone_offset);
    108108
    109109/**
     
    111111  localtime)
    112112**/
    113 _PUBLIC_ time_t pull_dos_date(const uint8_t *date_ptr, int zone_offset);
     113time_t pull_dos_date(const uint8_t *date_ptr, int zone_offset);
    114114
    115115/**
    116116like make_unix_date() but the words are reversed
    117117**/
    118 _PUBLIC_ time_t pull_dos_date2(const uint8_t *date_ptr, int zone_offset);
     118time_t pull_dos_date2(const uint8_t *date_ptr, int zone_offset);
    119119
    120120/**
     
    122122  these generally arrive as localtimes, with corresponding DST
    123123**/
    124 _PUBLIC_ time_t pull_dos_date3(const uint8_t *date_ptr, int zone_offset);
     124time_t pull_dos_date3(const uint8_t *date_ptr, int zone_offset);
    125125
    126126/**
     
    142142return a HTTP/1.0 time string
    143143**/
    144 _PUBLIC_ char *http_timestring(TALLOC_CTX *mem_ctx, time_t t);
     144char *http_timestring(TALLOC_CTX *mem_ctx, time_t t);
    145145
    146146/**
     
    149149 format is %a %b %e %X %Y %Z
    150150**/
    151 _PUBLIC_ char *timestring(TALLOC_CTX *mem_ctx, time_t t);
     151char *timestring(TALLOC_CTX *mem_ctx, time_t t);
    152152
    153153/**
    154154  return a talloced string representing a NTTIME for human consumption
    155155*/
    156 _PUBLIC_ const char *nt_time_string(TALLOC_CTX *mem_ctx, NTTIME nt);
     156const char *nt_time_string(TALLOC_CTX *mem_ctx, NTTIME nt);
    157157
    158158/**
    159159  put a NTTIME into a packet
    160160*/
    161 _PUBLIC_ void push_nttime(uint8_t *base, uint16_t offset, NTTIME t);
     161void push_nttime(uint8_t *base, uint16_t offset, NTTIME t);
    162162
    163163/**
    164164  pull a NTTIME from a packet
    165165*/
    166 _PUBLIC_ NTTIME pull_nttime(uint8_t *base, uint16_t offset);
     166NTTIME pull_nttime(uint8_t *base, uint16_t offset);
    167167
    168168/**
    169169  parse a nttime as a large integer in a string and return a NTTIME
    170170*/
    171 _PUBLIC_ NTTIME nttime_from_string(const char *s);
     171NTTIME nttime_from_string(const char *s);
    172172
    173173/**
    174174  return (tv1 - tv2) in microseconds
    175175*/
    176 _PUBLIC_ int64_t usec_time_diff(const struct timeval *tv1, const struct timeval *tv2);
     176int64_t usec_time_diff(const struct timeval *tv1, const struct timeval *tv2);
    177177
    178178/**
    179179  return (tp1 - tp2) in nanoseconds
    180180*/
    181 _PUBLIC_ int64_t nsec_time_diff(const struct timespec *tp1, const struct timespec *tp2);
     181int64_t nsec_time_diff(const struct timespec *tp1, const struct timespec *tp2);
    182182
    183183/**
    184184  return a zero timeval
    185185*/
    186 _PUBLIC_ struct timeval timeval_zero(void);
     186struct timeval timeval_zero(void);
    187187
    188188/**
    189189  return true if a timeval is zero
    190190*/
    191 _PUBLIC_ bool timeval_is_zero(const struct timeval *tv);
     191bool timeval_is_zero(const struct timeval *tv);
    192192
    193193/**
    194194  return a timeval for the current time
    195195*/
    196 _PUBLIC_ struct timeval timeval_current(void);
     196struct timeval timeval_current(void);
    197197
    198198/**
    199199  return a timeval struct with the given elements
    200200*/
    201 _PUBLIC_ struct timeval timeval_set(uint32_t secs, uint32_t usecs);
     201struct timeval timeval_set(uint32_t secs, uint32_t usecs);
    202202
    203203/**
    204204  return a timeval ofs microseconds after tv
    205205*/
    206 _PUBLIC_ struct timeval timeval_add(const struct timeval *tv,
     206struct timeval timeval_add(const struct timeval *tv,
    207207                           uint32_t secs, uint32_t usecs);
    208208
     
    216216  return a timeval secs/usecs into the future
    217217*/
    218 _PUBLIC_ struct timeval timeval_current_ofs(uint32_t secs, uint32_t usecs);
     218struct timeval timeval_current_ofs(uint32_t secs, uint32_t usecs);
     219
     220/**
     221  return a timeval milliseconds into the future
     222*/
     223struct timeval timeval_current_ofs_msec(uint32_t msecs);
     224
     225/**
     226  return a timeval microseconds into the future
     227*/
     228struct timeval timeval_current_ofs_usec(uint32_t usecs);
    219229
    220230/**
     
    224234  Return 1 if tv1 > tv2
    225235*/
    226 _PUBLIC_ int timeval_compare(const struct timeval *tv1, const struct timeval *tv2);
     236int timeval_compare(const struct timeval *tv1, const struct timeval *tv2);
    227237
    228238/**
    229239  return true if a timer is in the past
    230240*/
    231 _PUBLIC_ bool timeval_expired(const struct timeval *tv);
     241bool timeval_expired(const struct timeval *tv);
    232242
    233243/**
    234244  return the number of seconds elapsed between two times
    235245*/
    236 _PUBLIC_ double timeval_elapsed2(const struct timeval *tv1, const struct timeval *tv2);
     246double timeval_elapsed2(const struct timeval *tv1, const struct timeval *tv2);
    237247
    238248/**
    239249  return the number of seconds elapsed since a given time
    240250*/
    241 _PUBLIC_ double timeval_elapsed(const struct timeval *tv);
     251double timeval_elapsed(const struct timeval *tv);
     252
     253/**
     254  return the number of seconds elapsed between two times
     255*/
     256double timespec_elapsed2(const struct timespec *ts1,
     257                         const struct timespec *ts2);
     258/**
     259  return the number of seconds elapsed since a given time
     260*/
     261double timespec_elapsed(const struct timespec *ts);
    242262
    243263/**
    244264  return the lesser of two timevals
    245265*/
    246 _PUBLIC_ struct timeval timeval_min(const struct timeval *tv1,
     266struct timeval timeval_min(const struct timeval *tv1,
    247267                           const struct timeval *tv2);
    248268
     
    250270  return the greater of two timevals
    251271*/
    252 _PUBLIC_ struct timeval timeval_max(const struct timeval *tv1,
     272struct timeval timeval_max(const struct timeval *tv1,
    253273                           const struct timeval *tv2);
    254274
     
    258278  (this is *tv2 - *tv1)
    259279*/
    260 _PUBLIC_ struct timeval timeval_until(const struct timeval *tv1,
     280struct timeval timeval_until(const struct timeval *tv1,
    261281                             const struct timeval *tv2);
    262282
     
    264284  convert a timeval to a NTTIME
    265285*/
    266 _PUBLIC_ NTTIME timeval_to_nttime(const struct timeval *tv);
     286NTTIME timeval_to_nttime(const struct timeval *tv);
    267287
    268288/**
    269289  convert a NTTIME to a timeval
    270290*/
    271 _PUBLIC_ void nttime_to_timeval(struct timeval *tv, NTTIME t);
     291void nttime_to_timeval(struct timeval *tv, NTTIME t);
    272292
    273293/**
    274294  return the UTC offset in seconds west of UTC, or 0 if it cannot be determined
    275295 */
    276 _PUBLIC_ int get_time_zone(time_t t);
     296int get_time_zone(time_t t);
    277297
    278298/**
     
    283303void interpret_dos_date(uint32_t date,int *year,int *month,int *day,int *hour,int *minute,int *second);
    284304
    285 struct timespec nt_time_to_unix_timespec(NTTIME *nt);
     305struct timespec nt_time_to_unix_timespec(NTTIME nt);
    286306
    287307time_t convert_timespec_to_time_t(struct timespec ts);
     
    291311bool null_timespec(struct timespec ts);
    292312
    293 /** Extra minutes to add to the normal GMT to local time conversion. */
    294 extern int extra_time_offset;
     313struct timespec convert_timeval_to_timespec(const struct timeval tv);
     314struct timeval convert_timespec_to_timeval(const struct timespec ts);
     315struct timespec timespec_current(void);
     316struct timespec timespec_min(const struct timespec *ts1,
     317                             const struct timespec *ts2);
     318int timespec_compare(const struct timespec *ts1, const struct timespec *ts2);
     319void round_timespec_to_sec(struct timespec *ts);
     320void round_timespec_to_usec(struct timespec *ts);
     321NTTIME unix_timespec_to_nt_time(struct timespec ts);
    295322
    296323#endif /* _SAMBA_TIME_H_ */
Note: See TracChangeset for help on using the changeset viewer.