Skip to content

Commit

Permalink
Backport of fix logging time arch and os into release/1.20.x (#22139)
Browse files Browse the repository at this point in the history
* backport of commit 4af4c12

* backport of commit 5484f38

---------

Co-authored-by: Dhia Ayachi <dhia.ayachi@gmail.com>
  • Loading branch information
hc-github-team-consul-core and dhiaayachi authored Feb 12, 2025
1 parent 31c76b7 commit 152c4b7
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 2 deletions.
2 changes: 1 addition & 1 deletion logging/logfile_bsd.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// Copyright (c) HashiCorp, Inc.
// SPDX-License-Identifier: BUSL-1.1

//go:build darwin || freebsd || netbsd || openbsd
//go:build freebsd || netbsd || openbsd

package logging

Expand Down
19 changes: 19 additions & 0 deletions logging/logfile_darwin.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
// Copyright (c) HashiCorp, Inc.
// SPDX-License-Identifier: BUSL-1.1

//go:build darwin

package logging

import (
"os"
"syscall"
"time"
)

func (l *LogFile) createTime(stat os.FileInfo) time.Time {
stat_t := stat.Sys().(*syscall.Stat_t)
createTime := stat_t.Ctimespec
// Sec and Nsec are int32 in 32-bit architectures.
return time.Unix(int64(createTime.Sec), int64(createTime.Nsec)) //nolint:unconvert
}
2 changes: 1 addition & 1 deletion logging/logfile_linux.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// Copyright (c) HashiCorp, Inc.
// SPDX-License-Identifier: BUSL-1.1

//go:build dragonfly || linux
//go:build dragonfly || linux || darwin

package logging

Expand Down

0 comments on commit 152c4b7

Please sign in to comment.