1
0
mirror of https://git.FreeBSD.org/ports.git synced 2024-12-29 05:38:00 +00:00

Fix return value of local timezone methods such as getHours().

PR:		ports/80198
Submitted by:	Simun Mikecin <sime@logos.hr> (maintainer)
Approved by:	adamw (mentor, implicit)
This commit is contained in:
Jean-Yves Lefort 2005-04-21 19:11:08 +00:00
parent 498545ef30
commit 75c6b086e2
Notes: svn2git 2021-03-31 03:12:20 +00:00
svn path=/head/; revision=133886
2 changed files with 27 additions and 1 deletions

View File

@ -7,7 +7,7 @@
PORTNAME= see
PORTVERSION= 1.2
PORTREVISION= 1
PORTREVISION= 2
CATEGORIES= lang
MASTER_SITES= http://www.netsw.org/softeng/lang/js/ \
http://www.adaptive-enterprises.com.au/~d/software/see/

View File

@ -0,0 +1,26 @@
--- libsee/obj_Date.c.orig 2004-10-17 15:50:50.000000000 +0200
+++ libsee/obj_Date.c 2005-04-21 14:51:24.086576359 +0200
@@ -113,13 +113,16 @@
static SEE_number_t DateFromTime(SEE_number_t); /* 15.9.1.5 */
#define WeekDay(t) modulo(Day(t)+4,7) /* 15.9.1.6 */
-/*
- * XXX TODO: timezone conversion functions. Currently we assume local == UTC
- */
-#define LocalTZA 0 /* 15.9.1.7 */
-#define DaylightSavingTA(t) 0 /* 15.9.1.8 */
-#define LocalTime(t) ((t) + LocalTZA + DaylightSavingTA(t)) /* 15.9.1.9 */
-#define UTC(t) ((t) - LocalTZA - DaylightSavingTA(t - LocalTZA))
+#define UTC(t) (t)
+SEE_number_t LocalTime(SEE_number_t t) {
+ SEE_number_t ret;
+ const time_t tt=time(NULL);
+ ret=timegm(localtime(&tt));
+ ret-=tt;
+ ret*=1000;
+ ret+=t;
+ return ret;
+}
/* 15.9.1.10 */
#define HourFromTime(t) modulo(floor((t) / msPerHour), HoursPerDay)