Re: Re[2]: [PHP-GTK-DEV] GtkCalendar::get_date()

From: Date: Wed, 15 Mar 2006 17:17:10 +0000
Subject: Re: Re[2]: [PHP-GTK-DEV] GtkCalendar::get_date()
References: 1 2 3 4 5 6  Groups: php.gtk.dev 
Request: Send a blank email to php-gtk-dev+get-2619@lists.php.net to get a copy of this message
Are you suggesting adding 1 or 2 flags to get_date() to control this? -Andrei On Mar 15, 2006, at 3:31 AM, Steph Fox wrote:
Hi Tom, Yep, we discussed it at some length - don't you remember? - and in fact this is still part of the same discussion. It just sorta went into hibernation for a while there. I was looking at an implementation that uses a BC wrapper named php_mktime().... something had changed (e.g. ext/date) to make it useable for returning a timestamp in PHP 5_1 API. And then Christmas interfered with the creative process and everyone (okay, I) forgot all about it :-( Now Andrei's saying there are too many ways to convert the ymd triplet to a timestamp, but I don't know about that... that wrapper covers all the possibilities he mentioned. PHPAPI void php_mktime(INTERNAL_FUNCTION_PARAMETERS, int gmt); if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|lllllll", &hou, &min, &sec, &mon, &day, &yea, &dst) == FAILURE) { RETURN_FALSE; } Basically we'd need a GST (UTC these days?) flag to determine whether we're asking for mktime() - I think that would be the default - or gmmktime(), and another flag to allow PHP-GTK users to switch off DST. Although that DST parameter throws an E_STRICT at present, I can see that function potentially changing in future to override the parameter and fully use the timezone information available to it; currently it ignores the existence of DST when it's calculating, so we _have_ to use it if we want to reflect local time. If that's not altogether clear, take a look at this: C:\php5>php -r "echo ini_get('date.timezone');" Europe/London C:\php5>php -r "echo date('M d Y', mktime(0, 0, 0, 1, 15, 06));" Jan 15 2006 C:\php5>php -r "echo date('M d Y', mktime(0, 0, 0, 6, 15, 06));" Jun 15 2006 C:\php5>php -r "echo date('M d Y', mktime(0, 0, 0, 1, 15, 06, 1));" Strict Standards: mktime(): The is_dst parameter is deprecated in Command line code on line 1 Jan 14 2006 C:\php5>php -r "echo date('M d Y', mktime(0, 0, 0, 6, 15, 06, 1));" Strict Standards: mktime(): The is_dst parameter is deprecated in Command line code on line 1 Jun 15 2006 I switched to London because I'm not entirely sure what the DST situation is in Jerusalem this (or any other) year, but London's fairly predictable :) - Steph


« previous php.gtk.dev (#2619) next »