Re: System time/timezone, was Re: Maximum size .bash_aliases file
On Tue, Jun 18, 2024 at 23:09:04 -0500, David Wright wrote:
> On Tue 18 Jun 2024 at 07:07:36 (-0400), Greg Wooledge wrote:
> > On Mon, Jun 17, 2024 at 23:54:03 -0500, David Wright wrote:
> > > What should I call the timezone of my computer when it's booted up and
> > > no users are logged in?
> >
> > Daemons will almost always use the system's default time zone (the one
> > specified by /etc/localtime or /etc/timezone).
> >
> > It's *theoretically* possible for some daemons to be configured to use
> > a different time zone, or to be hard-coded to use UTC. I've never seen
> > this, but it could be done.
>
> In view of that, I think it's reasonable to drop the "default",
> and go with "system time zone", ie the time zone that the system
> clock it set to.
I strongly disagree. The system clock is kept on "epoch time", which
is the number of seconds since midnight, January 1, 1970 UTC.
The system clock doesn't have a time zone of its own. It just gets
converted to a time and date within any given time zone on demand.
Whatever process wants to perform such a conversion will either use UTC,
or the system's default time zone, or a user-specified time zone.
The date(1) command has the ability to do all three:
hobbit:~$ date; date -u; TZ=Europe/Moscow date
Wed Jun 19 07:06:00 EDT 2024
Wed Jun 19 11:06:00 UTC 2024
Wed Jun 19 14:06:00 MSK 2024
In order, those are the system's default time zone (America/New_York
in my case), UTC, and a user-specified time zone.
If you want the raw epoch time, it can do that as well:
hobbit:~$ date +%s
1718795213
The epoch time does not change when you use the -u option or the TZ
variable, either. It's independent of those.
Reply to: