Skip to content

Commit

Permalink
Loosen atomic orderings
Browse files Browse the repository at this point in the history
  • Loading branch information
jhpratt committed Mar 19, 2024
1 parent be2c931 commit c01a9b5
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions time/src/util.rs
Original file line number Diff line number Diff line change
Expand Up @@ -85,13 +85,13 @@ pub mod local_offset {
/// - [`UtcOffset::local_offset_at`](crate::UtcOffset::local_offset_at)
/// - [`UtcOffset::current_local_offset`](crate::UtcOffset::current_local_offset)
pub unsafe fn set_soundness(soundness: Soundness) {
LOCAL_OFFSET_IS_SOUND.store(soundness == Soundness::Sound, Ordering::SeqCst);
LOCAL_OFFSET_IS_SOUND.store(soundness == Soundness::Sound, Ordering::Release);
}

/// Obtains the soundness of obtaining the local UTC offset. If it is [`Soundness::Unsound`],
/// it is allowed to invoke undefined behavior when obtaining the local UTC offset.
pub fn get_soundness() -> Soundness {
match LOCAL_OFFSET_IS_SOUND.load(Ordering::SeqCst) {
match LOCAL_OFFSET_IS_SOUND.load(Ordering::Acquire) {
false => Soundness::Unsound,
true => Soundness::Sound,
}
Expand Down

0 comments on commit c01a9b5

Please sign in to comment.