[pbs-devel] [RFC proxmox 2/5] time: allow leap seconds when parsing RFC3339

Fabian Grünbichler f.gruenbichler at proxmox.com
Tue Sep 15 12:20:51 CEST 2020


we don't ever produce those, but they are valid RFC3339 strings

Signed-off-by: Fabian Grünbichler <f.gruenbichler at proxmox.com>
---

Notes:
    alternatively: print a nice error message for seconds == 60, these should only
    ever happen when we parse some user provided RFC3339 string..

 proxmox/src/tools/time.rs | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/proxmox/src/tools/time.rs b/proxmox/src/tools/time.rs
index 78d75b9..f7faade 100644
--- a/proxmox/src/tools/time.rs
+++ b/proxmox/src/tools/time.rs
@@ -257,7 +257,7 @@ pub fn parse_rfc3339(i: &str) -> Result<i64, Error> {
         expect(13, b':')?;
         tm.set_min(check_max(digit(14)?*10 + digit(15)?, 59)?)?;
         expect(16, b':')?;
-        tm.set_sec(check_max(digit(17)?*10 + digit(18)?, 59)?)?;
+        tm.set_sec(check_max(digit(17)?*10 + digit(18)?, 60)?)?;
 
         let epoch = tm.into_epoch()?;
         if tz == b'Z' {
-- 
2.20.1






More information about the pbs-devel mailing list