How to manage timezone

Hi,

I’ve found all of commit timestamps in RhodeCode web interface are displayed
according to UTC timezone, however time offsets (ago stanzas) are absolutely
correct. I can’t find how to manage, how could it be done?

Thanks.

Hi,

The commits timezone is read directly from VCS metadata. There’s no way to change that.

Hi, Marcin.

Hmm… Probably we talk about different things. Please, take a look, here is commit log from terminal:

reddot@valov:/srv/repos/theram$ TZ=UTC hg log -r 777
changeset:   777:722d4645542b
user:        Roman Valov <...>
date:        Wed Jun 22 19:21:35 2016 +0300
summary:     fix: ram logo path.

here is the same commit displayed in RhodeCode web interface:

So, RhodeCode correctly determine timezones and convert dates to UTC timezone in web interface. However local timezone for the server is +0300 (and commit triggers show timezone is correct in RhodeCode process environment). I think it should be more convenient to display timestamps in web interface in local timezone, not in UTC. Is there a way to do it?

You would have to modify this: https://code.rhodecode.com/rhodecode-enterprise-ce/files/tip/rhodecode/lib/datelib.py#L38

Where can I find this file after installation on disk?

If you use CE edition probably in ~/.rccontrol/enterprise-1/profile/…/rhodecode/lib/datelib.py

there should be a symlink that points to the source

OK, I’ve found it, but tzoffset parameter is not used, or am I missing something here?

Yes, it’s not used, the logic is actually in the utcfromtimestamp() i think it’s enough to replace it with fromtimestamp()
(https://docs.python.org/2/library/datetime.html#datetime.datetime.fromtimestamp) which represents a local timezone of server.

If that works for you we might think of some global flag to control this server wide.

It does not. Time “Ago” value is right with utcfromtimestamp(), but tooltip is wrong(). When I switch to fromtimestamp(), the tooltip is right, but Time “Ago” is wrong.

Hi, guys.

Unfortunately I haven’t found time to work with RhodeCode code base. However when I tried to do it I’ve got two ideas:

  1. Probably more correct way to deal with timezones would be to keep utc timestamps on the server side and to represent timestamps according to browser timezone on the client side (and manage it with JavaScript code). However quick review gives me a perception that client-side timestamp/timezone management is not centralized.

  2. It seems that older versions of RC (i.e. my 2.x installation) correctly shows timestamps according to local timezones. So it could be a regression issue.

Roman.

I think it also needs timeago change to not use UTC.

  • we talked with the team, and we think we really need set your timezone feature in RhodeCode. We will make this in next release