Skip to content

Commit

Permalink
Revise doc of NTP64::as_secs_f64()
Browse files Browse the repository at this point in the history
  • Loading branch information
JEnoch committed Sep 15, 2023
1 parent cfc70c0 commit 291c1b2
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/ntp64.rs
Original file line number Diff line number Diff line change
Expand Up @@ -66,10 +66,10 @@ impl NTP64 {

/// Returns this NTP64 as a f64 in seconds.
///
/// The decimal part of the f64 is the result of a division of NTP64's Fraction part by 2^32.
/// As a consequence, the even if resulting f64 seems to have a precision lower than 1 nanosecond,
/// that's not the case. It still has the precision of the time source
/// (3.5 nanosecond if generated by [`crate::HLC`]).
/// The integer part of the f64 is the NTP64's Seconds part.
/// The decimal part of the f64 is the result of a division of NTP64's Fraction part divided by 2^32.
/// Considering the probable large number of Seconds (for a time relative to UNIX_EPOCH), the precision of the resulting f64 might be in the order of microseconds.
/// Therefore, it should not be used for comparison. Directly comparing [NTP64] objects is preferable.
#[inline]
pub fn as_secs_f64(&self) -> f64 {
let secs: f64 = self.as_secs() as f64;
Expand Down

0 comments on commit 291c1b2

Please sign in to comment.