iliaa           Tue Nov 29 15:43:54 2005 EDT

  Modified files:              (Branch: PHP_5_1)
    /php-src    NEWS 
    /php-src/ext/date   php_date.c 
  Log:
  Added missing support for 'B' format identifier to date() function.
  
  
http://cvs.php.net/diff.php/php-src/NEWS?r1=1.2027.2.251&r2=1.2027.2.252&ty=u
Index: php-src/NEWS
diff -u php-src/NEWS:1.2027.2.251 php-src/NEWS:1.2027.2.252
--- php-src/NEWS:1.2027.2.251   Tue Nov 29 15:19:52 2005
+++ php-src/NEWS        Tue Nov 29 15:43:52 2005
@@ -1,6 +1,7 @@
 PHP                                                                        NEWS
 |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
 ?? ??? 200?, PHP 5.1.2
+- Added missing support for 'B' format identifier to date() function. (Ilia)
 - Improved SPL: (Marcus)
   . Added class SplFileInfo as root class for DirectoryIterator and 
     SplFileObject
http://cvs.php.net/diff.php/php-src/ext/date/php_date.c?r1=1.43.2.26&r2=1.43.2.27&ty=u
Index: php-src/ext/date/php_date.c
diff -u php-src/ext/date/php_date.c:1.43.2.26 
php-src/ext/date/php_date.c:1.43.2.27
--- php-src/ext/date/php_date.c:1.43.2.26       Tue Nov 29 15:19:56 2005
+++ php-src/ext/date/php_date.c Tue Nov 29 15:43:53 2005
@@ -16,7 +16,7 @@
    +----------------------------------------------------------------------+
  */
 
-/* $Id: php_date.c,v 1.43.2.26 2005/11/29 20:19:56 iliaa Exp $ */
+/* $Id: php_date.c,v 1.43.2.27 2005/11/29 20:43:53 iliaa Exp $ */
 
 #include "php.h"
 #include "php_streams.h"
@@ -494,7 +494,15 @@
                        /* time */
                        case 'a': snprintf(buffer, 32, "%s", t->h >= 12 ? "pm" 
: "am"); break;
                        case 'A': snprintf(buffer, 32, "%s", t->h >= 12 ? "PM" 
: "AM"); break;
-                       case 'B': snprintf(buffer, 32, "[B unimplemented]"); 
break;
+                       case 'B': {
+                               int retval = (((((long)t->sse)-(((long)t->sse) 
- ((((long)t->sse) % 86400) + 3600))) * 10) / 864);                      
+                               while (retval < 0) {
+                                       retval += 1000;
+                               }
+                               retval = retval % 1000;
+                               snprintf(buffer, 32, "%03d", retval); break;
+                               break;
+                       }
                        case 'g': snprintf(buffer, 32, "%d", (t->h % 12) ? 
(int) t->h % 12 : 12); break;
                        case 'G': snprintf(buffer, 32, "%d", (int) t->h); break;
                        case 'h': snprintf(buffer, 32, "%02d", (t->h % 12) ? 
(int) t->h % 12 : 12); break;

-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to