From a4f9413950554094d5fe301bef6ee3d57a479dfa Mon Sep 17 00:00:00 2001 From: Pascal Stumpf Date: Fri, 21 Feb 2014 18:02:36 +0100 Subject: [PATCH] Fix dtcm build on OpenBSD-current. libcompat and header files will be gone in the upcoming 5.5 release, so we cannot use the ftime(3) interface there. Fall back to the SVR4 version of the code, but use the tm_gmtoff field of struct tm to get the timezone. Unfortunately, that is not portable (because I really really would like to remove that old and crummy struct timeb from the public API). --- cde/programs/dtcm/dtcm/Imakefile | 2 +- cde/programs/dtcm/libDtCmP/getdate.h | 2 +- cde/programs/dtcm/libDtCmP/getdate.y | 6 +++++- 3 files changed, 7 insertions(+), 3 deletions(-) diff --git a/cde/programs/dtcm/dtcm/Imakefile b/cde/programs/dtcm/dtcm/Imakefile index e889c16a..971a9bbe 100644 --- a/cde/programs/dtcm/dtcm/Imakefile +++ b/cde/programs/dtcm/dtcm/Imakefile @@ -32,7 +32,7 @@ EXTRA_LIBRARIES = -lrpcsvc -lPW -ldiag EXTRA_LIBRARIES = -lrpcsvc -lV3 #endif -#if defined(BSDArchitecture) +#if defined(BSDArchitecture) && !defined(OpenBSDArchitecture) EXTRA_LIBRARIES = -lcompat #endif diff --git a/cde/programs/dtcm/libDtCmP/getdate.h b/cde/programs/dtcm/libDtCmP/getdate.h index fbab931b..214750bb 100644 --- a/cde/programs/dtcm/libDtCmP/getdate.h +++ b/cde/programs/dtcm/libDtCmP/getdate.h @@ -52,7 +52,7 @@ #ifndef _GETDATE_H #define _GETDATE_H -#ifdef USG +#if defined(USG) || defined(__OpenBSD__) struct timeb { time_t time; diff --git a/cde/programs/dtcm/libDtCmP/getdate.y b/cde/programs/dtcm/libDtCmP/getdate.y index e3238220..907e2c07 100644 --- a/cde/programs/dtcm/libDtCmP/getdate.y +++ b/cde/programs/dtcm/libDtCmP/getdate.y @@ -528,11 +528,15 @@ time_t cm_getdate(char *p, struct timeb *now) lptr = p; if (now == ((struct timeb *) NULL)) { now = &ftz; -#ifdef SVR4 +#if defined(SVR4) || defined(__OpenBSD__) tod = time(0); lt = localtime(&tod); now->time = lt->tm_sec; +#ifdef __OpenBSD__ + now->timezone = lt->tm_gmtoff / 60; +#else now->timezone = timezone/60; +#endif #else ftime(&ftz); #endif /* SVR4 */ -- 2.25.1