ProgrammingThis forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
In a php script on my server, if i use $_SERVER['REQUEST_TIME'] to get the system clock time, and from that script execute a binary on the same server written in C which uses the time() function, will both functions always return the same clock value? That is to say, will the return value of time() in the C module always be within a few milliseconds of the $_SERVER['REQUEST_TIME'] value in the php script?
Am thinking perhaps one or the other function may be affected by an environment variable to adjust according to a time zone or daylight savings?
I think it can vary more if you have a slow posting/uploading client.
Quote:
'REQUEST_TIME'
The timestamp of the start of the request. Available since PHP 5.1.0.
This number is from the web server. If it's a slow POST, daylight time changes while transfering data, you can get very different numbers. You can use time() in PHP to get the time when the function is called.
'REQUEST_TIME'
The timestamp of the start of the request. Available since PHP 5.1.0.
.
.
.
You can use time() in PHP to get the time when the function is called.
So, 'the time when the function is called' is the time when the php script is loaded? And the 'start of the request' is when the script executes the particular line of code? Or vice-versa?
php time() and c time() get time in second, so if php code execution duration between both calls is less than one second (likely), $ptime and $ctime should have the same value, and same value as $req_time (no executed code between $req_time and $ptime settings)
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.