gmstrftime

From: Date: Wed, 07 Jul 1999 20:39:51 +0000
Subject: gmstrftime
Groups: php.dev 
Request: Send a blank email to php-dev+get-8183@lists.php.net to get a copy of this message
Here's a patch against the latest CVS to add a gmstrftime() function that is to strftime() what gmdate() is to date(). I use gmdate() to print out various formatted times now (the input stamps are in GMT), but I need to print them out (soon) varied by different locale settings. Hence gmstrftime().

Index: basic_functions.c =================================================================== RCS file: /repository/php3/functions/basic_functions.c,v retrieving revision 1.271 diff -r1.271 basic_functions.c 136a137 > {"gmstrftime", php3_gmstrftime, NULL}, Index: datetime.c =================================================================== RCS file: /repository/php3/functions/datetime.c,v retrieving revision 1.66 diff -r1.66 datetime.c 544,546c544 < /* {{{ proto string strftime(string format[, int timestamp]) < Format a local time/date according to locale settings */ < void php3_strftime(INTERNAL_FUNCTION_PARAMETERS) --- > void _php3_strftime(INTERNAL_FUNCTION_PARAMETERS, int gm) 579,580c577,581 < ta = localtime(&timestamp); < --- > if (gm) { > ta = gmtime(&timestamp); > } else { > ta = localtime(&timestamp); > } 594a596,610 > > /* {{{ proto string strftime(string format[, int timestamp]) > Format a local time/date according to locale settings */ > void php3_strftime(INTERNAL_FUNCTION_PARAMETERS) > { > _php3_strftime(INTERNAL_FUNCTION_PARAM_PASSTHRU, 0); > } > /* }}} */ > > /* {{{ proto string gmstrftime(string format[, int timestamp]) > Format a GMT/CUT time/date according to locale settings */ > void php3_gmstrftime(INTERNAL_FUNCTION_PARAMETERS) > { > _php3_strftime(INTERNAL_FUNCTION_PARAM_PASSTHRU, 1); > } 595a612 > Index: datetime.h =================================================================== RCS file: /repository/php3/functions/datetime.h,v retrieving revision 1.14 diff -r1.14 datetime.h 45a46 > extern void php3_gmstrftime(INTERNAL_FUNCTION_PARAMETERS); Attachment: [text/plain ] gms.doc.diff gms.doc.diff
« previous php.dev (#8183) next »