Skip to content

Commit 2f35fbc

Browse files
committed
changed the decimal point from , to .. (cf. rust-lang/rust#15934)
ISO 8601 allows for both but prefers `,`, which was a main reason for its use in rust-chrono. but this is too alien given other usages of decimal points in Rust, so I guess it is better to switch to `.`.
1 parent 110c7de commit 2f35fbc

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

src/duration.rs

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -332,11 +332,11 @@ impl fmt::Show for Duration {
332332
if self.nanos == 0 {
333333
try!(write!(f, "T{}S", self.secs));
334334
} else if self.nanos % 1_000_000 == 0 {
335-
try!(write!(f, "T{},{:03}S", self.secs, self.nanos / 1_000_000));
335+
try!(write!(f, "T{}.{:03}S", self.secs, self.nanos / 1_000_000));
336336
} else if self.nanos % 1_000 == 0 {
337-
try!(write!(f, "T{},{:06}S", self.secs, self.nanos / 1_000));
337+
try!(write!(f, "T{}.{:06}S", self.secs, self.nanos / 1_000));
338338
} else {
339-
try!(write!(f, "T{},{:09}S", self.secs, self.nanos));
339+
try!(write!(f, "T{}.{:09}S", self.secs, self.nanos));
340340
}
341341
}
342342
Ok(())
@@ -406,15 +406,15 @@ mod tests {
406406
assert_eq!(Duration::days(42).to_string(), "P42D".to_string());
407407
assert_eq!(Duration::days(-42).to_string(), "P-42D".to_string());
408408
assert_eq!(Duration::seconds(42).to_string(), "PT42S".to_string());
409-
assert_eq!(Duration::milliseconds(42).to_string(), "PT0,042S".to_string());
410-
assert_eq!(Duration::microseconds(42).to_string(), "PT0,000042S".to_string());
411-
assert_eq!(Duration::nanoseconds(42).to_string(), "PT0,000000042S".to_string());
409+
assert_eq!(Duration::milliseconds(42).to_string(), "PT0.042S".to_string());
410+
assert_eq!(Duration::microseconds(42).to_string(), "PT0.000042S".to_string());
411+
assert_eq!(Duration::nanoseconds(42).to_string(), "PT0.000000042S".to_string());
412412
assert_eq!((Duration::days(7) + Duration::milliseconds(6543)).to_string(),
413-
"P7DT6,543S".to_string());
413+
"P7DT6.543S".to_string());
414414

415415
// the format specifier should have no effect on `Duration`
416416
assert_eq!(format!("{:30}", Duration::days(1) + Duration::milliseconds(2345)),
417-
"P1DT2,345S".to_string());
417+
"P1DT2.345S".to_string());
418418
}
419419
}
420420

0 commit comments

Comments
 (0)