All new Registrations are manually reviewed and approved, so a short delay after registration may occur before your account becomes active.
How to set time in OpenVZ container
I want to share my experience of solving time problem inside OpenVZ container.
This article is not related to KVM containers, they should have no problems with time.
OpenVZ container is running on same Linux kernel as host machine, and OpenVZ container is very well isolated from host system and cannot change many important system-wide parameters.
Problem #1: Bad container timezone
Time is wrong, difference can be measured in hours.
'date' command - result: Wed Mar 8 10:15:05 GMT 2017
'date' command - expected result: Wed Mar 8 15:15:05 GMT+5 2017
Solution: 'dpkg-reconfigure tzdata'.
System clock keep running in UTC time, your container timezone is changed, you see correct time in your console but always can check original UTC clock (with command 'date -u' or any other way).
Problem #2: Bad system time
Time is wrong, difference can be measured in minutes.
'date' command - result: Wed Mar 8 10:15:05 GMT 2017
'date' command - expected result: Wed Mar 8 10:37:05 GMT 2017
'ntpdate time.nist.gov' - result: Operation not permitted
'date -s 10:37' - result: Operation not permitted
Solution 1: Ask your provider to allow you to change system time.
Google quickly finds a command like "vzctl set 101 --capability sys_time:on --save". But this is bad solution because your container will be able to set whole system time (for other containers, too). Your provider should not give you this option.
Solution 2: Ask your provider to fix time on host system. The best variant but depends on provider support quality. Solution can take some time.
Solution 3: Do it yourself. Use libfaketime
Most google links say that it's impossible to change time inside OpenVZ container. But you can change time for your important applications, even for shell. You can use special library for any application and it will tune time to any value. Link is here: https://github.com/wolfcw/libfaketime, there is complete instruction about installation and usage.
Proof:
Comments
Just what we need, library injections to deal with a common problem of hosts being too lazy to setup NTP before going to production.
Or you can link to your timezone:
I am afraid you did not read the post. Time is accurate, just the timezone does not fit, which is expected, you cannot get international customers from only one timezone, in most cases.
No, you're right. I didn't read the post, nor check the code, and see that it basically runs strtotime() on an environmental variable. Please enlighten me, since time_t can be computed by localtime or GMT, and generally the systems are setup appropriately to do so, even if they're not syncronized.
You havent read my post either.
I guess I was being too subtle about making fun of you. Have a nice preload.
Initially I was thinking to use
sudo timedatectl set-timezone
but I was unsure whether it will work or not.This thread helped me to do it properly with command
sudo dpkg-reconfigure tzdata
Thank you for this thread
Holy necropost
Not to mention that the OP is long gone
Please read the rules
Thread closed