# Accepting time_t as an argument

- Thread: https://externals.io/message/1451
- Original archive: https://news-web.php.net/php.internals/1451
- Started by Hans Zaunere on 2003-05-12T18:29:02+00:00
- Messages: 2
- Reply by email to internals@lists.php.net
- More for agents: search with https://externals.io/search.md?q={query} · JSON API at https://externals.io/api · documentation at https://externals.io/llms.txt

---

## #1452 — Sterling Hughes — 2003-05-12T17:39:24+00:00

URL: https://externals.io/message/1451#1452 · In reply to: #1451

> 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.

-Sterling

> Thank you,
> 
> Hans
-- 
Good judgement comes from experience, and experience comes from 
bad judgement. 
    - Fred Brooks

---

## #1451 — Hans Zaunere — 2003-05-12T18:29:02+00:00

URL: https://externals.io/message/1451#1451

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()

Thank you,

Hans
