Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rename to_timestamp to get_timestamp #542

Merged
merged 1 commit into from Oct 31, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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)
};
}
}