1
0
mirror of https://github.com/php/php-src.git synced 2026-03-26 09:12:14 +01:00

vs.net 2005 introduces 64-bit time_t.

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.
This commit is contained in:
Wez Furlong
2005-08-13 02:23:29 +00:00
parent 7c14b0169a
commit c2909b377b
5 changed files with 9 additions and 6 deletions

View 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;

View 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;

View 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:

View 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);

View 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);