]> granicus.if.org Git - php/commitdiff
vs.net 2005 introduces 64-bit time_t.
authorWez Furlong <wez@php.net>
Sat, 13 Aug 2005 02:23:29 +0000 (02:23 +0000)
committerWez Furlong <wez@php.net>
Sat, 13 Aug 2005 02:23:29 +0000 (02:23 +0000)
I can't say that I think this is a great idea, but it does highlight a couple
of dodgy areas where we assume that ints and longs are the same thing as
time_t's.  Let's try to ensure that we declare structure fields and function
parameters with the correct type when we're talkingabout time_t's, to avoid
possibly nasty problems with passing the wrong sized thing around.

ext/com_dotnet/com_variant.c
ext/standard/basic_functions.h
ext/standard/datetime.c
ext/standard/pageinfo.c
ext/standard/pageinfo.h

index 8372a6d93146a699070f5dd25e0ff87f1dc54a59..6030ae915a509f00f2c0f2da55353543418e88cf 100644 (file)
@@ -789,6 +789,7 @@ PHP_FUNCTION(variant_date_to_timestamp)
 PHP_FUNCTION(variant_date_from_timestamp)
 {
        long timestamp;
+       time_t ttstamp;
        SYSTEMTIME systime;
        struct tm *tmv;
        VARIANT res;
@@ -800,7 +801,8 @@ PHP_FUNCTION(variant_date_from_timestamp)
 
        VariantInit(&res);
        tzset();
-       tmv = localtime(&timestamp);
+       ttstamp = timestamp;
+       tmv = localtime(&ttstamp);
        memset(&systime, 0, sizeof(systime));
 
        systime.wDay = tmv->tm_mday;
index a4ef3005d0514b49f4318611e9fe685af99d4155..bfedc992cdfaaea9b8386ce237139bc613d50b36 100644 (file)
@@ -173,7 +173,7 @@ typedef struct _php_basic_globals {
        long page_uid;
        long page_gid;
        long page_inode;
-       long page_mtime;
+       time_t page_mtime;
 
        /* filestat.c && main/streams/streams.c */
        char *CurrentStatFile, *CurrentLStatFile;
index 8f4c54109923404ea06207af8de045949ad2e57f..93b58959ffd15598b47f747316b86fd5c6eb33a7 100644 (file)
@@ -71,7 +71,7 @@ static int phpday_tab[2][12] = {
 
 /* {{{ php_idate
  */
-PHPAPI int php_idate(char format, int timestamp, int gm)
+PHPAPI int php_idate(char format, time_t timestamp, int gm)
 {
        time_t the_time;
        struct tm *ta, tmbuf;
@@ -178,7 +178,8 @@ PHPAPI int php_idate(char format, int timestamp, int gm)
 PHP_FUNCTION(idate)
 {
        zval **format, **timestamp;
-       int t, ret;
+       int ret;
+       time_t t;
 
        switch (ZEND_NUM_ARGS()) {
                case 1:
index 7fc6d954903fead8f4c4e526cbe34c5810563cb6..fd99ed41ae505ec096134201be12027749618a36 100644 (file)
@@ -158,7 +158,7 @@ PHP_FUNCTION(getmyinode)
 }
 /* }}} */
 
-PHPAPI long php_getlastmod(TSRMLS_D)
+PHPAPI time_t php_getlastmod(TSRMLS_D)
 {
        php_statpage(TSRMLS_C);
        return BG(page_mtime);
index 1239d880dac716623ee951ed71857e24a70fa33b..7adf343af5d8e8c2534000bb46c3c472e080d067 100644 (file)
@@ -28,7 +28,7 @@ PHP_FUNCTION(getmyinode);
 PHP_FUNCTION(getlastmod);
 
 PHPAPI void php_statpage(TSRMLS_D);
-PHPAPI long php_getlastmod(TSRMLS_D);
+PHPAPI time_t php_getlastmod(TSRMLS_D);
 extern long php_getuid(void);
 extern long php_getgid(void);