Skip to content

Commit

Permalink
FIXUP: <#54 (review)>
Browse files Browse the repository at this point in the history
  • Loading branch information
Kijewski committed Aug 15, 2022
1 parent 9454971 commit 6c6ee1c
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/tz_macos.rs
Expand Up @@ -11,9 +11,12 @@ unsafe fn get_timezone() -> Option<String> {
// The longest name in the IANA time zone database is 25 ASCII characters long.
const MAX_LEN: usize = 32;

// Get system time zone, and its name.
// Get system time zone, and borrow its name.
let tz = Dropping::new(CFTimeZoneCopySystem())?;
let name = Dropping::new(CFTimeZoneGetName(tz.0))?;
let name = match CFTimeZoneGetName(tz.0) {
name if !name.is_null() => name,
_ => return None,
};

// Copy the name into the buffer.
let mut buf = [0; MAX_LEN];
Expand Down

0 comments on commit 6c6ee1c

Please sign in to comment.