Re: Accepting time_t as an argument

From: Date: Tue, 13 May 2003 13:31:57 +0000
Subject: Re: Accepting time_t as an argument
References: 1  Groups: php.internals 
Request: Send a blank email to internals+get-1472@lists.php.net to get a copy of this message
--- Sterling Hughes <sterling@bumblebury.com> wrote: > On Mon, 2003-05-12 at 14:29, Hans Zaunere wrote: > > I have a function that will be implemented in an extension: > > > > ZEND_FUNCTION(msr_set_time); > > > > which started life as a real C function: > > > > void msr_set_time( const time_t ts ); > > > > I'm using Andrei's way, zend_parse_parameters(), to handle arguments. > So, > > > > long l; > > zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &l); > > > > seems to make sense. But, what if my code ends up on a platform where > time_t > > is an int? Essentially, the question is how to use compiler specific > > typedefs with zend_parse_parameters() > > > > well you could register a resource, but a long is fine. Just cast it to > a time_t when you pass it. You shouldn't have to worry about overflows. Yeah, already have a resource for the serial port, so I'll probably just go with the cast; I'll just put a nice comment reminder in the code :) Thanks Sterling, welcome home, H > > -Sterling > > > Thank you, > > > > Hans > -- > Good judgement comes from experience, and experience comes from > bad judgement. > - Fred Brooks >

« previous php.internals (#1472) next »