8

I'm connecting to my remote SSH Debian server account with no root privileges. Is there a way to change/set the time from the server's local time (US) to my local time (Poland; Central European Summer Time, GMT+2)?

1
  • 2
    The actual time for the server is not something you can change without root access - but you can set the display time (for applications that support such an override) to your local time zone. See man7.org/linux/man-pages/man8/tzselect.8.html
    – HBruijn
    Oct 1, 2019 at 18:44

2 Answers 2

17

Yes, in a general way you can use:

$ tzselect

At the end of the selection it will tell you how to make the change permanent for the session, and for all future sessions.

In your case this might be enough:

$ TZ='Europe/Warsaw'; export TZ

then check with date. If you add that line to .profile you should make that change permanent for your user.

5

All sane operating systems store time internally in UTC. That is universal time (number of second since the beginning of 1 Jan 1970, in Greenwich England). It is then converted to local time whenever displayed.

It needs to be this way, as computers need to agree on the time when communicating, and computers can communicate across time-zones.

For example if a file is added to the server from someone in England the 5 minuets latter another file added from Poland. Then which should have the earlier time. The one that is added first. However if we used local time, the one from Poland would have a head start, and be recorded as added first.

4
  • 3
    This answers the question, the answer involving tzselect does not. But I suspect that the tzselect answer soles the actual problem that motivated the question. Oct 2, 2019 at 5:24
  • 7
    UTC is not "number of seconds since 1 Jan 1970". It is a time system, independent of any representation. Also, do not confuse the phrase "seconds since the epoch" (which is defined by Posix) with the number of seconds since 1 Jan 1970. ("seconds since the epoch" ignore leap seconds.) Oct 2, 2019 at 9:04
  • 1
    @MartinBonner I don't understand your comment (I know of many complications with time. E.g. leap seconds). However I don't understand the distinction between 1970-01-01 and the epoch (that is 1970-01-01). Are you saying that the epoch is system dependent (and therefore systems using a different epoch need to consider the difference). And what do you mean ignore leap-seconds? Surely these system must just count the seconds. Therefore leap-seconds will be ignored as a by-product of ignoring clock time. Oct 2, 2019 at 15:22
  • @ctrl-alt-delor: POSIX time is "nominally" UTC seconds-since-the-epoch, but also defined in terms of fixed 86400-second calendar days. These are contradictory. In practice POSIX time is one of (1) approximate UT1, (2) smoothed UTC, or (3) a discontiguous mess with stuff breaking every time there's a leap-second. Oct 2, 2019 at 17:09

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .