#26359 [Opn->Csd]: posix_times gives a very large value, not related with the uptime
| From: | vrana@php.net | Date: | Mon, 26 Jul 2004 20:06:02 +0000 |
| Subject: | #26359 [Opn->Csd]: posix_times gives a very large value, not related with the uptime | ||
| References: | 1 | Groups: | php.doc |
| Request: | Send a blank email to phpdoc+get-969362194@lists.php.net to get a copy of this message | ||
ID: 26359
Updated by: vrana@php.net
Reported By: whooper at dap dot ro
-Status: Open
+Status: Closed
Bug Type: Documentation problem
Operating System: FreeBSD 4.9
PHP Version: 4.3.3
New Comment:
This bug has been fixed in the documentation's XML sources. Since the
online and downloadable versions of the documentation need some time
to get updated, we would like to ask you to be a bit patient.
Thank you for the report, and for helping us make our documentation
better.
Previous Comments:
------------------------------------------------------------------------
[2003-11-23 01:33:54] sniper@php.net
"The function times returns the number of clock ticks that have
elapsed since an arbitrary point in the past. For Linux this point
is the moment the system was booted. This return value may overflow
the possible range of type clock_t."
See also:
http://www.omc.net/cgi-bin/man.cgi?section=7&topic=clocks
This function really isn't reliable to use. Simply put: Don't use it.
------------------------------------------------------------------------
[2003-11-22 09:46:31] whooper at dap dot ro
Description:
------------
Configure Command
FreeBSD www.dap.ro 4.9-RELEASE FreeBSD 4.9-RELEASE #0: Wed Nov i386 ,
Apache/1.3.28
'./configure' '--enable-versioning' '--enable-memory-limit'
'--with-layout=GNU' '--with-zlib-dir=/usr' '--disable-all'
'--with-regex=php' '--with-apxs=/usr/local/sbin/apxs'
'--with-bz2=/usr'
'--enable-ctype' '--enable-dba' '--with-dom=/usr/local'
'--enable-ftp'
'--with-gd' '--enable-gd-native-ttf' '--enable-gd-jis-conv'
'--with-freetype-dir=/usr/local' '--with-jpeg-dir=/usr/local'
'--with-png-dir=/usr/local' '--with-inifile'
'--with-mcrypt=/usr/local'
'--with-mhash=/usr/local' '--with-mime-magic=/usr/share/misc/magic.mime'
'--with-mysql=/usr/local' '--with-openssl=/usr' '--enable-overload'
'--with-pcre-regex=yes' '--enable-posix' '--enable-session'
'--enable-sockets' '--enable-tokenizer' '--enable-xml'
'--with-expat-dir=/usr/local' '--with-xmlrpc' '--enable-xslt'
'--with-xslt-sablot=/usr/local' '--with-zlib=yes'
'--prefix=/usr/local'
'i386-portbld-freebsd4.9'
Loaded modules :
mod_php4, mod_setenvif, mod_so, mod_unique_id, mod_usertrack,
mod_headers, mod_expires, mod_cern_meta, mod_proxy, mod_digest,
mod_auth_db, mod_auth_anon, mod_auth, mod_access, mod_rewrite,
mod_alias, mod_userdir, mod_speling, mod_actions, mod_imap, mod_asis,
mod_cgi, mod_dir, mod_autoindex, mod_include, mod_info, mod_status,
mod_negotiation, mod_mime, mod_mime_magic, mod_log_config, mod_env,
mod_vhost_alias, mod_mmap_static, http_core
Reproduce code:
---------------
<?php
function uptime() {
$uptime = posix_times();
// set uptime in "day hours min" format
$upsecs = floor($uptime["ticks"]/100);
if ($upsecs <= 3600 ){$upmins=floor($upsecs/60);
if ( $upmins <= "9" ) {$upmins="0".$upmins;}
$upnow=$upmins." minutes";
} else {
if ($upsecs <= 86400 ){
$uphours=floor($upsecs/3600);
$upmins=floor($upsecs/60 - $uphours*60);
if ( $upmins <= "9" ) {$upmins="0".$upmins;}
$upnow=$uphours." hours and ".$upmins."minutes";
} else {
$updays=floor($upsecs/86400);
$uphours=floor($upsecs/3600 - $updays*24);
$upmins=floor($upsecs/60 - $uphours*60 -$updays*60*24);
if ( $upmins <= "9" ){$upmins="0".$upmins;}
$upnow=$updays." days, ".$uphours." hours and ".$upmins." minutes";
}
}
return $upnow;
}
?>
Expected result:
----------------
Services UpTime: 2 days, 3 hours, 15 minutes
Actual result:
--------------
Services UpTime: 0-90328 minutes
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=26359&edit=1