Skip to content

Commit

Permalink
Merge pull request #542 from KodrAus/fix/timestamp-name
Browse files Browse the repository at this point in the history
Rename to_timestamp to get_timestamp
  • Loading branch information
KodrAus committed Oct 31, 2021
2 parents 3ff12ee + 4908b4e commit b32f372
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/v1.rs
Expand Up @@ -225,7 +225,7 @@ impl Uuid {
/// value into more commonly-used formats, such as a unix timestamp.
///
/// [`Timestamp`]: v1/struct.Timestamp.html
pub const fn to_timestamp(&self) -> Option<Timestamp> {
pub const fn get_timestamp(&self) -> Option<Timestamp> {
match self.get_version() {
Some(Version::Mac) => {
let ticks: u64 = ((self.as_bytes()[6] & 0x0F) as u64) << 56
Expand Down Expand Up @@ -299,7 +299,7 @@ mod tests {
"20616934-4ba2-11e7-8000-010203040506"
);

let ts = uuid.to_timestamp().unwrap().to_rfc4122();
let ts = uuid.get_timestamp().unwrap().to_rfc4122();

assert_eq!(ts.0 - 0x01B2_1DD2_1381_4000, 14_968_545_358_129_460);
assert_eq!(ts.1, 0);
Expand All @@ -315,7 +315,7 @@ mod tests {
uuid2.to_hyphenated().to_string(),
"20616934-4ba2-11e7-8001-010203040506"
);
assert_eq!(uuid2.to_timestamp().unwrap().to_rfc4122().1, 1)
assert_eq!(uuid2.get_timestamp().unwrap().to_rfc4122().1, 1)
};
}
}

0 comments on commit b32f372

Please sign in to comment.