summaryrefslogtreecommitdiff
path: root/ext/date/lib/timelib.c
diff options
context:
space:
mode:
authorDerick Rethans <derick@php.net>2005-12-19 13:00:37 (GMT)
committerDerick Rethans <derick@php.net>2005-12-19 13:00:37 (GMT)
commit7b581f6d19957871df502c8563a4eae8e54c15ca (patch)
tree460c86b1d8eac8aa0de09db74a80855c6c09c2bd /ext/date/lib/timelib.c
parent32220d2e7e60d68ecdf245fb69b4f9208ec37fe0 (diff)
downloadphp-7b581f6d19957871df502c8563a4eae8e54c15ca.tar.gz
- MFH: Merged new timelib, which is a bit more cleverer
- MFH: Support "UTC" in strtotime() properly. - MFH: Added astro code, which is going to form the base for the new sunfuncs.
Diffstat (limited to 'ext/date/lib/timelib.c')
-rw-r--r--ext/date/lib/timelib.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/ext/date/lib/timelib.c b/ext/date/lib/timelib.c
index 18bcf9f..be0dc1a 100644
--- a/ext/date/lib/timelib.c
+++ b/ext/date/lib/timelib.c
@@ -20,6 +20,7 @@
#include "timelib.h"
#include <ctype.h>
+#include <math.h>
#define TIMELIB_TIME_FREE(m) \
if (m) { \
@@ -139,6 +140,13 @@ signed long timelib_date_to_int(timelib_time *d, int *error)
return (signed long) d->sse;
}
+void timelib_decimal_hour_to_hms(double h, int *hour, int *min, int *sec)
+{
+ *hour = floor(h);
+ *min = floor((h - *hour) * 60);
+ *sec = (h - *hour - ((float) *min / 60)) * 3600;
+}
+
void timelib_dump_date(timelib_time *d, int options)
{
if ((options & 2) == 2) {