github.com/keybase/client/go@v0.0.0-20241007131713-f10651d043c8/kbfs/libfs/time_equal.go (about) 1 // Copyright 2016 Keybase Inc. All rights reserved. 2 // Use of this source code is governed by a BSD 3 // license that can be found in the LICENSE file. 4 5 package libfs 6 7 import ( 8 "time" 9 10 "github.com/keybase/client/go/libkb" 11 "github.com/keybase/client/go/protocol/keybase1" 12 ) 13 14 // TimeEqual compares two filesystem-related timestamps. 15 // 16 // On platforms that don't use nanosecond-accurate timestamps in their 17 // filesystem APIs, it truncates the timestamps to make them 18 // comparable. 19 func TimeEqual(a, b time.Time) bool { 20 if libkb.RuntimeGroup() == keybase1.RuntimeGroup_DARWINLIKE { 21 a = a.Truncate(1 * time.Second) 22 b = b.Truncate(1 * time.Second) 23 } 24 return a.Equal(b) 25 }