Giter Club home page Giter Club logo

Comments (8)

cdown avatar cdown commented on August 25, 2024 1

Yeah, having TZ set to UTC will do that.

It's probably set somewhere in your bash profile/rc, or the global one. There are some tips on finding out where it may have came from here: https://unix.stackexchange.com/q/813/10762

For now, you can also do unset TZ; date.

from tzupdate.

eriktux avatar eriktux commented on August 25, 2024 1

It works! Thank you so much.
I've been banging my head on the wall for a while, because of this ;)

from tzupdate.

cdown avatar cdown commented on August 25, 2024

Huh, that's intriguing. If tzupdate exited without error, it should have done the same thing.

What does stat /etc/localtime say? Which distribution is this?

from tzupdate.

eriktux avatar eriktux commented on August 25, 2024

It's Ubuntu 16.04.

stat /etc/localtime 
  File: '/etc/localtime' -> '/usr/share/zoneinfo/America/New_York'
  Size: 36              Blocks: 0          IO Block: 4096   symbolic link
Device: 5fh/95d Inode: 1300        Links: 1
Access: (0777/lrwxrwxrwx)  Uid: (    0/    root)   Gid: (    0/    root)
Access: 2018-01-15 21:30:35.980517343 +0000
Modify: 2018-01-15 21:30:35.980517343 +0000
Change: 2018-01-15 21:30:35.980517343 +0000
 Birth: -

from tzupdate.

cdown avatar cdown commented on August 25, 2024

Does this same behaviour occur with dpkg-reconfigure tzdata with "real" root and sudo?

from tzupdate.

eriktux avatar eriktux commented on August 25, 2024

dpkg-reconfigure tzdata seems to be interactive, it's ok like that?
So I choose America/New-York for my first test. Here are the results...

If I run as "real" root:

...
Current default time zone: 'America/New_York'
Local time is now:      Mon Jan 15 19:11:05 EST 2018.
Universal Time is now:  Tue Jan 16 00:11:05 UTC 2018.

date
Mon Jan 15 19:11:12 EST 2018

If I run as "sudo" (let's try Antartica):

...
Current default time zone: 'Antarctica/Davis'
Local time is now:      Tue Jan 16 07:15:35 +07 2018.
Universal Time is now:  Tue Jan 16 00:15:35 UTC 2018.

date
Tue Jan 16 00:16:18 UTC 2018

So this answer your question: Yes it seems like I'm having the same problem when I run your command. Why is it?

I also noticed something strange:
If I run the "date" command as root, I see actual date/time.
If I run the "date" command as sudo, I see UTC time!

So the user and root don't even have the same time... Isn't it weird?
For user, it seems like no matter what I try, it keeps showing UTC time.

from tzupdate.

cdown avatar cdown commented on August 25, 2024

What's the output of env and type date as root and your user?

from tzupdate.

eriktux avatar eriktux commented on August 25, 2024

as user:

env
SCREEN_HEIGHT=1020
HOSTNAME=zeck
DEBCONF_NONINTERACTIVE_SEEN=true
TERM=screen-256color
SCREEN_WIDTH=1360
LC_ALL=en_US.UTF-8
LS_COLORS=(removed for readability)
COLUMNS=268
PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
PWD=/home
NODE_UNREGISTER_IF_STILL_DOWN_AFTER=60000
SCREEN_DEPTH=24
LANG=en_US.UTF-8
TZ=UTC
LINES=74
HOME=/home/erik
LANGUAGE=en_US:en
DBUS_SESSION_BUS_ADDRESS=/dev/null
DEBIAN_FRONTEND=noninteractive
DISPLAY=:99.0
_=/usr/bin/env

type date
date is /bin/date

As root:

env
SHELL=/bin/bash
TERM=screen-256color
USER=root
LS_COLORS=(removed for readability)
MAIL=/var/mail/root
PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
PWD=/root
HOME=/root
LOGNAME=root
DISPLAY=:99.0
_=/usr/bin/env


date
date is /bin/date

Note: I see that regular user has env variable "TZ" set to "UTC".
Why is it?

(thanks for helping, btw)

from tzupdate.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.