Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 9 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,13 @@
# Changelog

## [v0.1.0](../../releases/tag/v0.1.0) - 2025-11-08
## [Unreleased]

### Fixed
- Replace HFS epoch (1904-01-01) sentinel timestamps with `timeNow`.

## [0.1.0] - 2025-11-08

- Initial release of **FSKitBridge**. See details in the [README](README.md).

[Unreleased]: ../../compare/v0.1.0...HEAD
[0.1.0]: ../../releases/tag/v0.1.0
18 changes: 16 additions & 2 deletions FSKitExt/Item.swift
Original file line number Diff line number Diff line change
@@ -1,7 +1,11 @@
import Darwin
import FSKit
import Foundation
import SwiftProtobuf

// Seconds for 1904-01-01 00:00:00 UTC in Unix epoch (1970-based)
private let HFSUnixEpochOffset: Int = -2_082_844_800

final class Item: FSItem {

private(set) var name: FSFileName
Expand Down Expand Up @@ -158,8 +162,18 @@ extension timespec {

func toProto() -> Google_Protobuf_Timestamp {
var ts = Google_Protobuf_Timestamp()
ts.seconds = Int64(self.tv_sec)
ts.nanos = Int32(self.tv_nsec)
let norm = normalize()
ts.seconds = Int64(norm.tv_sec)
ts.nanos = Int32(norm.tv_nsec)
return ts
}

private func normalize() -> timespec {
if self.tv_sec == HFSUnixEpochOffset {
var now = timespec()
clock_gettime(CLOCK_REALTIME, &now)
return now
}
return self
}
}