[pbs-devel] [PATCH proxmox-backup 07/10] tools/systemd/time: use i32 for DateTimeValues instead of u32

Dietmar Maurer dietmar at proxmox.com
Fri Sep 4 07:31:23 CEST 2020


> for most of the fields it does not matter
> (mon,day,hour,min,sec)
> 
> but for years it matters, since negative years in a tm struct are valid
> so to be able to handle that, convert those to i32

Sorry, but how can we get negative years? Simply disallow that is easier?

> on parsing, we never allow negative numbers anyway
> 
> also, this way we can drop the manual casts (which would have been very
> wrong if the underlying tm struct would have contained negative values)

I suggest to use try_from instead.





More information about the pbs-devel mailing list