timezone in php 5.6.x and above is not exactly? - centos

I'm using Linux CentOS 6.6 in my VPS Server
and installed php 5.6.12 and above (php 7)
also i did config php.ini date.timezone=Europe/Amsterdam
and use in php file something this :
date_default_timezone_set('Europe/Amsterdam'); echo date("Y-m-d H:i:s");
but the time is not exactly it show me more than real time Amsterdam !!! also i checked for other timezone area but it was same problem !
for example if real time Amsterdam is 10:50:30 show me 10:58:27 !
you can see 8 min is more than real time !!!
I thought my problem was in version of php, so i updated it from php5.6.12 to php7.0.7 but it was not solved !

I am convinced this has nothing to do with php. When you enter in the shell date - what do you get?
What about contacting the server provider regarding the time difference?
To me it looks like the NTP service is not running. Check Google for NTP Service or this link.
If you have full root access to your server may be installing an NTP service would be an option.

I found this problem
I had a Webmin Control Panel on my Linux Server, so i checked System Time (in the left Menu: Hardware-> System Time) module and set Timezone to UTC, after i saw that system time was 8 min more than right time UTC !
I just set Minute and Second time according UTC world time at worldtimeserver
thank you for attention

Related

Issue with timedatectl

Hi can any help me how timedatctl works
my understanding are
if system clock sysnc with NTP serivce through internet system time will be updated to current date and time.
If system clock sync with NTP it will update the RTC every 11 min is this right ?
but my observation :
please find the image where i tested by disabling the NTP serves
After enabling NTP service only local + Universal time got updated but Not RTC time why ?

SCOM agent heartbeat failed on solaris 11.4

i am using Operations Manager 2016 for monitoring a host with Solaris 11.4 OS.
after several hours (24 h), host state is changed to gray and i get this text "The Run As account does not exist on the UNIX/Linux Server. " but Run As account is valid.
This problem is fixed each time by reset SCOM agent on host. I get this error over and over again.
also service log in /var/svc/log/application-management-omid:default.log is normal.
thanks.
I finally found the solution to this problem.
In my case, this problem is due to the lack of a lsass.so library in the system.
The problem was resolved after updating this library and modifying the PAM Configuration file.
thanks.

How to change Date and Time settings on Google Cloud Instance?

I am trying to change Date and time settings to UTC+10 Canberra,Sydney,Melbourne on the instance but it always keep rolling back to UTC+00 Monrovio, Reykjavik. Doesn't matter even if I select set time zone to automatic.enter image description here
The zone "australia-southeast1-b" on the provided screenshot is a deployment area for Google Cloud Platform resources, where the physical hosts, your VM instance is running on, are physically located. This is a geographical zone. It is not relevant to time.
To configure Date and Time in Windows, you should:
set correct time zone in Windows and
make sure a time server is reachable
Google Cloud Engine VM instance is just a virtual machine that boots up with hardware clock set to UTC as many modern servers do nowadays.
If you looked at the VM instance logs in the GCP Console you'd see that VM BIOS reports time in UTC
2019/10/3 14:9:44 Begin firmware boot time
After a while BIOS hands over to the bootloader
2019/10/3 14:9:45 End firmware boot time
Booting from Hard Disk 0...
The OS boots up. Behind the scene the OS time service recognizes the system timezone, then sets up and synchronizes time with the time source. From that time forward running programs and services report events based on the local system time:
...
2019/10/03 09:10:05 GCEWindowsAgent: GCE Agent Started (version 4.6.0#1)
In the Windows Event Log you should see entries made by the Time-Service:
Log Name: System
Source: Time-Service
Level: Information
The time provider NtpClient is currently receiving valid time data from metadata.google.internal,0x1 (ntp.m|0x1|0.0.0.0:123->169.254.169.254:123).
The time service is now synchronizing the system time with the time source metadata.google.internal,0x1 (ntp.m|0x1|0.0.0.0:123->169.254.169.254:123).
In the command prompt you can ensure that the time configuration and state are correct:
C:\Users\user>systeminfo | find /i "Time"
System Boot Time: 10/3/2019, 9:09:49 AM
Time Zone: (UTC-06:00) Central Time (US & Canada)
Hence you don't need synchronizing time neither manually or with any startup script. The time service will do this for you: synchronize the system time shortly after the system boot and keep it in sync afterwards.
All you need is to set correct Time zone and the Internet time server for Windows, and then make sure the time server is reachable via the network.
If you can't wait for the timesync cycle completion, you can logon to Windows and force time synchronization manually:
net stop W32Time
net start W32Time
w32tm /resync /force
To O.P
Answer to your question if I understand correctly, your answer is:
timedatectl set-timezone "Australia/Melbourne"

PHP time() returns a timestamp that is 59 seconds behind real time

I have a dev environment and a production environment. The time() function returns the correct timestamp in my dev env but in my production environment time() is exactly 59 seconds behind!
The version of PHP is 7.0.3 on both environments.
This can't be a timezone issue since the difference is only one minute and the PHP default timezone is the same in both environments (America/Los Angeles).
It is now 10:48:29 am and here is the output from calling this function simultaneously in both environments (or at least as fast as I can press enter on the console).
Dev environment (is correct)
php > echo date('h:i:s A');
10:48:29 AM
Production environment (is one minute behind)
echo date('h:i:s A');
10:47:31 AM
Same happens with the time() function
Dev environment (is correct)
php > echo time();
1568742851
Production environment (is one minute behind)
echo time();
1568742792
And 1568742851 - 1568742792 = 59 secs
I know i could just add 59 seconds to the timestamp time() returns but that just seems like a hack and does not solve the problem. I would like to please get advice as to how to fix my production environment.
Confirm that you are allowing NTP traffic to your production OS environment. You can confirm that your server is properly communicating to NTP by running the following command ntpq -c peers If you receive a Connection refused prompt you don't have proper connectivity. You will need to configure an inbound firewall rule allowing UDP traffic on port 123. Once this is done, restart your NTP service service ntpd restart and rerun the ntpq -c peers command
I believe the system clock on your production and dev machine is unsync, Regardless of the version of PHP or Operating System, Just like #g_bor mentioned in comment.
Don't get confused by the time zone, Just run the command date +%s on system shell to print timestamp on both machines, If you have no permission (can't login with ssh), You can prepare the PHP file which contains system('date +%s');, And then, Upload to your web server and open the browser to check the timestamps on both your machines.

relation between simulator SUMO and Matlab via Traci4Matlab

I am new sumo user.
I am trying to tutorials (inter_palmas) for SUMO 0.26 in Windows (7 32 bit) and Traci4matlab (2015).
The status message shows in SUMO: Loading configuration..done , Starting server on port 8813 and doesn't proceed.
Even though I work for a week, I could not find a solution.
Thanks,
I noticed that in the recent traci4matlab source code they have changed the default port from 8813 to 8873. I changed my port in the .sumocfg file and now it works as intended.