From fb91c9416dba59516cb1ea3f3e6cf0137dc4ef34 Mon Sep 17 00:00:00 2001 From: OBATA Akio Date: Sun, 17 Oct 2021 12:19:52 +0900 Subject: [PATCH] dtcm: resolve mismatch between `tm.tm_gmtoff` and global `timezone` `timezone` and `tm.tm_gmtoff` represent reversed sign value each other. Change `tm.tm_gmtoff` usage to be matched with `timezone`. --- cde/programs/dtcm/libDtCmP/getdate.y | 2 +- cde/programs/dtcm/libDtCmP/timeops.c | 2 +- cde/programs/dtcm/server/rtable4.c | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/cde/programs/dtcm/libDtCmP/getdate.y b/cde/programs/dtcm/libDtCmP/getdate.y index c25bfbe8d..7b1d00122 100644 --- a/cde/programs/dtcm/libDtCmP/getdate.y +++ b/cde/programs/dtcm/libDtCmP/getdate.y @@ -531,7 +531,7 @@ time_t cm_getdate(char *p, struct timeb *now) lt = localtime(&tod); now->time = lt->tm_sec; #ifdef __OpenBSD__ - now->timezone = lt->tm_gmtoff / 60; + now->timezone = - lt->tm_gmtoff / 60; #else now->timezone = timezone/60; #endif diff --git a/cde/programs/dtcm/libDtCmP/timeops.c b/cde/programs/dtcm/libDtCmP/timeops.c index 7fc47f133..7660a2ec3 100644 --- a/cde/programs/dtcm/libDtCmP/timeops.c +++ b/cde/programs/dtcm/libDtCmP/timeops.c @@ -986,7 +986,7 @@ gmt_off(void) t = now(); tm = *_XLocaltime(&t, localtime_buf); - gmt = tm.tm_gmtoff; + gmt = - tm.tm_gmtoff; #endif /* SVR4 */ return(gmt); } diff --git a/cde/programs/dtcm/server/rtable4.c b/cde/programs/dtcm/server/rtable4.c index e44db64c3..bb1adc9e3 100644 --- a/cde/programs/dtcm/server/rtable4.c +++ b/cde/programs/dtcm/server/rtable4.c @@ -1423,7 +1423,7 @@ _DtCm_rtable_gmtoff_4_svc(void *args, struct svc_req *svcrq) #if defined(CSRG_BASED) ctime = time(NULL); t = localtime(&ctime); - gmtoff = t->tm_gmtoff; + gmtoff = - t->tm_gmtoff; #else gmtoff = timezone; #endif