meta time: use uint64_t instead of time_t
A message that is not in the archive (sent off-list or not yet received): [email protected]
PATCH 1/1 meta time: use uint64_t instead of time_t
time_t may be 32 bit on some platforms and thus can't fit a timestamp with nanoseconds resolution. This causes overflows and ultimatively breaks meta time expressions on such platforms.
Fix this by using uint64_t instead.
("meta: Introduce new conditions 'time', 'day' and 'hour'")
src/meta.c +1 -1
@@ -444,7 +444,7 @@ static struct error_record *date_type_pa struct expr **res) {const char *endptr = sym->identifier; -time_t tstamp; +uint64_t tstamp;if ((tstamp =parse_iso_date (sym->identifier)) !=-1 ) goto success;
Quoted 5 lines · Lukas Straub
time_tmay be 32 bit on some platforms and thus can't fit a timestamp with nanoseconds resolution. This causes overflows and ultimatively breaks meta time expressions on such platforms.Fix this by using
uint64_tinstead.
Applied, thanks
Phil Sutter
reviewerQuoted 16 lines · Lukas Straub
time_tmay be 32 bit on some platforms and thus can't fit a timestamp with nanoseconds resolution. This causes overflows and ultimatively breaks meta time expressions on such platforms.Fix this by using
uint64_tinstead.Fixes f8f32deda31df597614d9f1f64ffb0c0320f4d54("meta: Introduce new conditions 'time', 'day' and 'hour'")
Signed-off-by Lukas Straub <[email protected]>Index:
b/src/meta.c
===================================================================
src/meta.c static struct error_record *date_type_pa · line 449
Quoted 7 lines
src/meta.c +1
-1@@ -444,7 +444,7 @@ static struct error_record *date_type_pa struct expr **res) {const char *endptr = sym->identifier; -time_t tstamp; +uint64_t tstamp;if ((tstamp =parse_iso_date (sym->identifier)) !=-1 )
Doesn't this introduce a warning due to signed/unsigned comparison?
I guess you'll have to cast -1 to uint64_t as well.
Cheers, Phil