TalkPHP
 
 
Account Login
Latest Articles
» The basic usage of PHPTAL, a XML/XHTML template library for PHP
» Vulnerable methods and the areas they are commonly trusted in.
» Simple way to protect a form from bot
» The Basics On: How Session Stealing Works
» How to keep your forms from double posting data
IRC Channel
IRC Speech Bubble Join the friendly bunch on IRC...
(#TalkPHP on Freenode)

...Also available via a web interface.

See this thread for information on the TalkPHP Free Hugs Initiative™. Subject to availability.
Associates
Associates
CSS Tutorials
Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old 04-13-2009, 10:31 PM   #1 (permalink)
The Frequenter
Zend Certified 
 
Join Date: Sep 2007
Location: Denmark
Posts: 352
Thanks: 8
Kalle is on a distinguished road
Default strptime

Hey

So I've been playing about with BSD's strptime() implementation (written in C). Currently PHP does not support strptime() on Windows because the lack of that function in Microsoft's Standard C Library, however I was wondering if anyone of you non Windozers could try the following script (under prefered the most recent version of php) and post the output:

PHP Code:
<?php
    date_default_timezone_set
('UTC');

    
$format '%d/%m/%Y %H:%M:%S';
    
$strf strftime($formatmktime(1554191032004));

    echo 
"$strf\n";

    
print_r(strptime($strf$format));
?>
Currently on my local Windows build I get:
Code:
03/10/2004 15:54:19
Array
(
    [tm_sec] => 19
    [tm_min] => 54
    [tm_hour] => 15
    [tm_mday] => 3
    [tm_mon] => 9
    [tm_year] => 34
    [tm_wday] => 0
    [tm_yday] => 0
    [unparsed] =>
)
Comparing it to a result generated by a Linux box:
Code:
03/10/2004 15:54:19
Array
(
    [tm_sec] => 19
    [tm_min] => 54
    [tm_hour] => 15
    [tm_mday] => 3
    [tm_mon] => 9
    [tm_year] => 104
    [tm_wday] => 0
    [tm_yday] => 276
    [unparsed] => 
)
Which indicates that the tm_year is off by 70 in my sample and the tm_yday isn't even getting set. So I'm eager to find out the results so I can compare if they are consistent, and if anyone got a *BSD box and is able to run this script on it and tell me the results it would be just perfect! =)


Cheers
__________________
Send a message via MSN to Kalle Send a message via Skype™ to Kalle
Kalle is offline  
Reply With Quote
Old 04-13-2009, 11:16 PM   #2 (permalink)
Moderateur
RegEx Guru PHP Guru Top Contributor Advanced Programmer 
 
Salathe's Avatar
 
Join Date: Apr 2007
Posts: 1,393
Thanks: 5
Salathe is on a distinguished road
Default

Here's what comes out of an OS X box, if that helps:
Code:
03/10/2004 15:54:19
Array
(
    [tm_sec] => 19
    [tm_min] => 54
    [tm_hour] => 15
    [tm_mday] => 3
    [tm_mon] => 9
    [tm_year] => 104
    [tm_wday] => 0
    [tm_yday] => 0
    [unparsed] => 
)
Salathe is offline  
Reply With Quote
Old 04-13-2009, 11:47 PM   #3 (permalink)
The Frequenter
Zend Certified 
 
Join Date: Sep 2007
Location: Denmark
Posts: 352
Thanks: 8
Kalle is on a distinguished road
Default

Quote:
Originally Posted by Salathe View Post
Here's what comes out of an OS X box, if that helps:
Code:
03/10/2004 15:54:19
Array
(
    [tm_sec] => 19
    [tm_min] => 54
    [tm_hour] => 15
    [tm_mday] => 3
    [tm_mon] => 9
    [tm_year] => 104
    [tm_wday] => 0
    [tm_yday] => 0
    [unparsed] => 
)
Thanks Salathe, OSX is a BSD variant so it should be good enough :)
__________________
Send a message via MSN to Kalle Send a message via Skype™ to Kalle
Kalle is offline  
Reply With Quote
Old 04-14-2009, 01:50 AM   #4 (permalink)
The Frequenter
Zend Certified 
 
Join Date: Sep 2007
Location: Denmark
Posts: 352
Thanks: 8
Kalle is on a distinguished road
Default

Great I got it working with the same results as you Salathe, for those interested I've created a diff:
http://www.pastie.org/445636

;)
__________________
Send a message via MSN to Kalle Send a message via Skype™ to Kalle
Kalle is offline  
Reply With Quote
Reply



Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
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

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


All times are GMT. The time now is 08:24 PM.

 
     

Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.1.0
Inactive Reminders By Icora Web Design