mirror of
https://gitlab.torproject.org/tpo/core/tor.git
synced 2025-02-25 07:07:52 +01:00
Add a portable tor_timercmp
We can't use the platform timercmp, because 1) some platforms don't have them 2) some that do have them only support certain relational operators
This commit is contained in:
parent
9516c1efdb
commit
94a99ad205
1 changed files with 7 additions and 0 deletions
|
@ -332,6 +332,13 @@ struct tm *tor_localtime_r(const time_t *timep, struct tm *result);
|
||||||
struct tm *tor_gmtime_r(const time_t *timep, struct tm *result);
|
struct tm *tor_gmtime_r(const time_t *timep, struct tm *result);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
/** Return true iff the tvp is related to uvp according to the relational
|
||||||
|
* operator cmp. Recognized values for cmp are ==, <=, <, >=, and >. */
|
||||||
|
#define tor_timercmp(tvp, uvp, cmp) \
|
||||||
|
(((tvp)->tv_sec == (uvp)->tv_sec) ? \
|
||||||
|
((tvp)->tv_usec cmp (uvp)->tv_usec) : \
|
||||||
|
((tvp)->tv_sec cmp (uvp)->tv_sec))
|
||||||
|
|
||||||
/* ===== File compatibility */
|
/* ===== File compatibility */
|
||||||
int replace_file(const char *from, const char *to);
|
int replace_file(const char *from, const char *to);
|
||||||
int touch_file(const char *fname);
|
int touch_file(const char *fname);
|
||||||
|
|
Loading…
Add table
Reference in a new issue