strftime() bug?

This is a discussion on strftime() bug? within the PHP Language forums, part of the PHP Programming Forums category; Below the function I use to write notes to a log file, and some example output. Somehow some lines have ...


Go Back   Usenet Forums > PHP Programming Forums > PHP Language

FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 03-25-2007
Schraalhans Keukenmeester
 
Posts: n/a
Default strftime() bug?

Below the function I use to write notes to a log file, and some example
output. Somehow some lines have a differently formatted timestamp. I
have no clue as to what may cause this.
(Code ran on my host's production (shared) server, CentOS, Apache
2.0.52, PHP5.0.4)
Anyone an idea what's the most likely culprit?

My code:

function logwrite($note) {
$filename = '/tmp/phpscripts.log';
if (!$logfile = fopen($filename,'a'))
die("Could not open $logfile.");
$str = strftime('%c')." : ".$note;
fwrite($logfile,$str);
fclose($logfile);
}

Contents of example logfile
Sun Mar 25 13:24:30 2007 : Pageview...
Sun Mar 25 13:24:32 2007 : Pageview...
Sun Mar 25 13:37:25 2007 : Pageview...
Sun Mar 25 13:37:25 2007 : Pageview...
Sun 25 Mar 2007 01:56:19 PM CEST : Pageview...
Sun 25 Mar 2007 01:56:19 PM CEST : Pageview...
Sun Mar 25 13:56:25 2007 : Pageview...
Sun Mar 25 13:56:32 2007 : Pageview...
Sun 25 Mar 2007 01:56:43 PM CEST : Pageview...
Sun Mar 25 13:56:55 2007 : Pageview...
Reply With Quote
  #2 (permalink)  
Old 03-25-2007
shimmyshack
 
Posts: n/a
Default Re: strftime() bug?

On 25 Mar, 13:11, Schraalhans Keukenmeester <bitbuc...@invalid.spam>
wrote:
> Below the function I use to write notes to a log file, and some example
> output. Somehow some lines have a differently formatted timestamp. I
> have no clue as to what may cause this.
> (Code ran on my host's production (shared) server, CentOS, Apache
> 2.0.52, PHP5.0.4)
> Anyone an idea what's the most likely culprit?
>
> My code:
>
> function logwrite($note) {
> $filename = '/tmp/phpscripts.log';
> if (!$logfile = fopen($filename,'a'))
> die("Could not open $logfile.");
> $str = strftime('%c')." : ".$note;
> fwrite($logfile,$str);
> fclose($logfile);
>
> }
>
> Contents of example logfile
> Sun Mar 25 13:24:30 2007 : Pageview...
> Sun Mar 25 13:24:32 2007 : Pageview...
> Sun Mar 25 13:37:25 2007 : Pageview...
> Sun Mar 25 13:37:25 2007 : Pageview...
> Sun 25 Mar 2007 01:56:19 PM CEST : Pageview...
> Sun 25 Mar 2007 01:56:19 PM CEST : Pageview...
> Sun Mar 25 13:56:25 2007 : Pageview...
> Sun Mar 25 13:56:32 2007 : Pageview...
> Sun 25 Mar 2007 01:56:43 PM CEST : Pageview...
> Sun Mar 25 13:56:55 2007 : Pageview...


how are you setting the locale?
remember c% is the preferred date and time in the current locale

Reply With Quote
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are Off
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT +1. The time now is 05:51 PM.


Powered by vBulletin® Version 3.7.3
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO 3.0.0