# io: Redefine \`Clock.real\` to return timestamps relative to the POSIX/Unix epoch · gitcafe/zig

[View on GitCafe](https://git.cafe/gitcafe/zig/commit/5f1392247d8bb0c6355f2986ff6fbf09a0885b6f)

Repository: [gitcafe/zig](https://git.cafe/gitcafe/zig)

Visibility: public

Requested revision: 5f1392247d8bb0c6355f2986ff6fbf09a0885b6f

Requested commit: 5f1392247d8bb0c6355f2986ff6fbf09a0885b6f

Commit: 5f1392247d8bb0c6355f2986ff6fbf09a0885b6f

Tree: f2de8d88232d06748a01af9df1228e17911b3ddc

Author: Carl Åstholm

Committer: Carl Åstholm

## Message

```
io: Redefine `Clock.real` to return timestamps relative to the POSIX/Unix epoch

`Clock.real` being defined to return timestamps relative to an
implementation-specific epoch means that there's currently no way for
the user to translate returned timestamps to actual calendar dates
without digging into implementation details of any particular `Io`
implementation. Redefining it to return timestamps relative to
1970-01-01T00:00:00Z fixes this problem.

There are other ways to solve this, such as adding a new vtable function
for returning the implementation-specific epoch, but in terms of
complexity this redefinition is by far the simplest solution and only
amounts to a simple 96-bit integer addition's worth of overhead on OSes
like Windows that use non-POSIX/Unix epochs.

```

## Parents

- [ed7f2588e409b6d154f4a08bd0029ef1e7beb06b](https://git.cafe/gitcafe/zig/commit/ed7f2588e409b6d154f4a08bd0029ef1e7beb06b?format=markdown)

[Source at this commit](https://git.cafe/gitcafe/zig/tree/5f1392247d8bb0c6355f2986ff6fbf09a0885b6f?format=markdown)
