*BSD News Article 31649


Return to BSD News archive

Xref: sserve comp.unix.bsd:14151 comp.lang.c++:71831 comp.lang.c:72011 comp.os.vms:88499
Newsgroups: comp.unix.bsd,comp.lang.c++,comp.lang.c,comp.os.vms
Path: sserve!newshost.anu.edu.au!harbinger.cc.monash.edu.au!msuinfo!agate!howland.reston.ans.net!swrinde!news.uh.edu!uuneo.neosoft.com!jabberwock!daniels
From: daniels@biles.com (Brad Daniels)
Subject: Inverse gmtime?
Organization: Biles and Associates
Date: Fri, 10 Jun 1994 16:00:28 GMT
Message-ID: <Cr6v4t.FqB@biles.com>
Lines: 41

Sorry for the strange cross-posts, but there doesn't seem to be an ideal
group for this question:

I'm trying to write a C++ class which converts times back and forth between
UTC and local time.  I'm constrained to using ANSI library functions and
any home-grown stuff I need because we're going to run on VMS as well as
UNIX boxes, and we don't want to require that our customers run our program
under POSIX or that they buy a layered product like DCE.

The ANSI suite of time functions provides mktime() to convert a broken-down
local time to an internal time, and gmtime() to convert an internal time
to a broken-down UTC time, but there is no function to convert a broken-
down UTC time to an internal time.

Because VMS only stores local time, we grabbed the BSD sources for gmtime(),
and plan to massage them to work with a magic system logical which the user
will need to update using a DCL procedure we will provide.  I believe the
BSD source code is licensed in such a way as to allow us to do this, but
I'm not certain, and confirmation would be appreciated.

Both the UNIX and the VMS versions will also need a function to convert
a struct tm containing a UTC time into an internal time value, however.
Before I go on a coding binge attempting to invert gmtime(), though, I thought
I'd ask around if there is a function already written somewhere which I could
munge.

Is there one?  Is therea better suite of time functions I could be using?
We have the Rogue Wave time classes, but porting them to VMS looks to be
a potentially major headache, they are a bit cumbersome for our purposes,
and they don't provide microsecond resolution (which we need for some
externally generated times.)

Any suggestions will be much appreciated.

Thanks,
- Brad
------------------------------------------------------------
+ Brad Daniels                  | Was mich nicht umbringt  +
+ Biles and Associates          | macht mich hungrig.      +
+ These are my views, not B&A's |                          +
------------------------------------------------------------