php5
5.3.10
|
Go to the source code of this file.
Functions | |
PHP_FUNCTION (unixtojd) | |
PHP_FUNCTION (jdtounix) |
PHP_FUNCTION | ( | unixtojd | ) |
Definition at line 29 of file cal_unix.c.
{ time_t ts = 0; struct tm *ta, tmbuf; if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|l", &ts) == FAILURE) { return; } if (!ts) { ts = time(NULL); } else if (ts < 0) { RETURN_FALSE; } if (!(ta = php_localtime_r(&ts, &tmbuf))) { RETURN_FALSE; } RETURN_LONG(GregorianToSdn(ta->tm_year+1900, ta->tm_mon+1, ta->tm_mday)); }
PHP_FUNCTION | ( | jdtounix | ) |
Definition at line 54 of file cal_unix.c.
{ long uday; if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &uday) == FAILURE) { return; } uday -= 2440588 /* J.D. of 1.1.1970 */; if (uday < 0 || uday > 24755) { /* before beginning of unix epoch or behind end of unix epoch */ RETURN_FALSE; } RETURN_LONG(uday * 24 * 3600); }