Is there any file in unix based system which I can read, to get the same value that time() in php would return?
|
feedback
|
|
Unlike my other answer reading metadata, grepping through /proc for "sec" I indeed found a file containing the current system time:
EDIT: And another one: If you've also got some terminal access for development you can try yourself:
to find files containing the first digits of the unix timestamp (replace if using it later) in /sys you've got access to. | |||||||||
feedback
|
| |||||||
feedback
|
|
PHP's time() function returns seconds since the Unix epoch. You can format it as a date and/or time any way you want using other PHP functions. Unix's date command (at least the GNU version) can do the same
So you can easily create a file containing that number, as needed (e.g. using PHP's system() function) Or just read it directly
I can't think of a sensible use case for what you ask though. | ||||
|
feedback
|
date +%s. – Daniel Beck Oct 19 '11 at 16:45time()function. Why do you need to read it from a file? – Keith Thompson Oct 19 '11 at 17:43