/*============================================================================= * drt/sys/ktz.c * DRT primitive timezone functions for the 'struct drt_tz' type. * * History * 0.01, 1999-08-12, David R Tribble. * First cut. * * Copyright ©1999, by David R. Tribble, all rights reserved. * See "drt/sys/copyr.txt" for more information. *----------------------------------------------------------------------------*/ /* Identification */ static const char id[] = "@(#)drt/sys/ktz.c 0.01"; /* System includes */ #include #define drt_std_assert_h 1 #if TEST || DEBUG #include #define drt_std_stdio_h 1 #endif /* Special includes */ #include "kdefs.h" /* Local includes */ #include "kdebug.h" #include "ktime.h" #include "ktimec.h" /* Local macros */ #if TEST #if DEBUG #define T(e) (e) #else #define T(e) (0) #endif #else #define T(e) (0) #endif /*----------------------------------------------------------------------------- * Public constants *----------------------------------------------------------------------------*/ #if DRT_TZ_VS/100 != 1 #error DRT_TZ_VS has changed #endif const int drt_tz_VS = DRT_TZ_VS; /* Struct version number */ /*----------------------------------------------------------------------------- * Public functions *----------------------------------------------------------------------------*/ /*----------------------------------------------------------------------------- * drt_tz_validate() * Verifies that 'th' is a valid date object. * * Returns * True if 'th' is a valid object, otherwise false. *----------------------------------------------------------------------------*/ bool drt_tz_validate(const struct drt_tz *th) { #if DRT_TZ_VS != 101 #error DRT_TZ_VS has changed #endif /* Verify the object */ if (th == null) return (false); if (th->tz_vers/100 != DRT_TZ_VS/100) return (false); /* Object appears to be valid */ return (true); } /*----------------------------------------------------------------------------- * drt_tz_zero() * Initializes date object 'th', setting its members to reflect the zero * (Zulu, UT) timezone. * * Returns * True if pointer 'th' is not null, otherwise false. *----------------------------------------------------------------------------*/ bool drt_tz_zero(struct drt_tz *th) { #if DRT_TZ_VS != 101 #error DRT_TZ_VS has changed #endif #if DEBUG >= 2 DrtTrace dbg("drt_tz_zero"); #endif /* Initialize the date members to Zulu timezone */ th->tz_vers = DRT_TZ_VS; th->tz_hour = 0; th->tz_min = 0; th->tz_sec = 0; th->tz_dst = false; th->tz_name[0] = 'Z'; th->tz_name[1] = '\0'; return (true); } /* End ktz.c */