cvs: /php3/functions php3_mcal.c

From: Date: Tue, 07 Sep 1999 15:04:36 +0000
Subject: cvs: /php3/functions php3_mcal.c
Groups: php.dev 
Request: Send a blank email to php-dev+get-10665@lists.php.net to get a copy of this message
musone Tue Sep 7 11:04:36 1999 EDT Modified files: /php3/functions php3_mcal.c Log: added date comparison convenience function Index: php3/functions/php3_mcal.c diff -u php3/functions/php3_mcal.c:1.10 php3/functions/php3_mcal.c:1.11 --- php3/functions/php3_mcal.c:1.10 Tue Sep 7 10:54:19 1999 +++ php3/functions/php3_mcal.c Tue Sep 7 11:04:35 1999 @@ -1340,6 +1340,7 @@ } } + void php3_mcal_time_valid(INTERNAL_FUNCTION_PARAMETERS) { pval *hour,*min,*sec; @@ -1361,7 +1362,7 @@ convert_to_long(hour); convert_to_long(min); convert_to_long(sec); - if(datevalid(hour->value.lval,min->value.lval,sec->value.lval)) + if(timevalid(hour->value.lval,min->value.lval,sec->value.lval)) { RETURN_TRUE; } @@ -1371,18 +1372,100 @@ } } +void php3_mcal_day_of_week(INTERNAL_FUNCTION_PARAMETERS) +{ + pval *year,*month,*day; + int ind, ind_type; + unsigned long i; + char *t; + int mcal_folders=0; + unsigned int msgno; + pils *mcal_le_struct; + pval *pvalue,*temppvalue; + cal_list_t *my_cal_list; + int myargc; + unsigned long uid; + datetime_t mydate; + CALEVENT *myevent; + myargc=ARG_COUNT(ht); + if (myargc !=3 || getParameters(ht,myargc,&year,&month,&day) == FAILURE) { + WRONG_PARAM_COUNT; + } + convert_to_long(year); + convert_to_long(month); + convert_to_long(day); + dt_init(&mydate); + dt_setdate(&mydate,year->value.lval,month->value.lval, day->value.lval); + + RETURN_LONG(dt_dayofweek(&mydate)); +} + +void php3_mcal_day_of_year(INTERNAL_FUNCTION_PARAMETERS) +{ + pval *year,*month,*day; + int ind, ind_type; + unsigned long i; + char *t; + int mcal_folders=0; + unsigned int msgno; + pils *mcal_le_struct; + pval *pvalue,*temppvalue; + cal_list_t *my_cal_list; + int myargc; + unsigned long uid; + datetime_t mydate; + CALEVENT *myevent; + myargc=ARG_COUNT(ht); + if (myargc !=3 || getParameters(ht,myargc,&year,&month,&day) == FAILURE) { + WRONG_PARAM_COUNT; + } + convert_to_long(year); + convert_to_long(month); + convert_to_long(day); + dt_init(&mydate); + dt_setdate(&mydate,year->value.lval,month->value.lval, day->value.lval); + + RETURN_LONG(dt_dayofyear(&mydate)); +} /* returns <0, 0, >0 if a<b, a==b, a>b respectively */ -/*int dt_compare(const datetime_t *a, const datetime_t *b); */ +void php3_mcal_date_compare(INTERNAL_FUNCTION_PARAMETERS) +{ + pval *ayear,*amonth,*aday; + pval *byear,*bmonth,*bday; + int ind, ind_type; + unsigned long i; + char *t; + int mcal_folders=0; + unsigned int msgno; + pils *mcal_le_struct; + pval *pvalue,*temppvalue; + cal_list_t *my_cal_list; + int myargc; + unsigned long uid; + datetime_t myadate,mybdate; + CALEVENT *myevent; + myargc=ARG_COUNT(ht); + if (myargc !=6 || getParameters(ht,myargc,&ayear,&amonth,&aday,&byear,&bmonth,&bday) == FAILURE) { + WRONG_PARAM_COUNT; + } + convert_to_long(ayear); + convert_to_long(amonth); + convert_to_long(aday); + convert_to_long(byear); + convert_to_long(bmonth); + convert_to_long(bday); + dt_init(&myadate); + dt_init(&mybdate); + dt_setdate(&myadate,ayear->value.lval,amonth->value.lval, aday->value.lval); + dt_setdate(&mybdate,byear->value.lval,bmonth->value.lval, bday->value.lval); -/* returns the day-of-year of <dt> */ -/* int dt_dayofyear(const datetime_t *dt); */ + RETURN_LONG(dt_compare(&myadate,&mybdate)); +} -/* returns the day-of-week of <dt> */ -/* int dt_dayofweek(const datetime_t *dt); */

« previous php.dev (#10665) next »