× The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.



On Behalf Of Scott Klement

On 11/22/2011 12:40 PM, James Lampert wrote:

That is SLICK! I thought I'd come up with a simple solution (SUBDUR),
but this is even better (and doesn't require the time zone to be either
hardcoded or explicitly retrieved).

Dennis is calling the time() API, which has been a standard API on Unix
forever. But he seems to have added some extra code that I don't
understand the purpose for.

First:
Hopefully, you also saw the improved procedure at
http://code.midrange.com/8abba7dbd7.html, from this message:
http://archive.midrange.com/midrange-l/201111/msg00698.html

Scott, my reason for what might seem a strange definition of time_t was to
maintain a semblance of compatibility with C. While the C time.h could have
(should have?) defined time_t as an integer (or some numeric), it does not -
in any variant that I have found. One cannot do math (sans cast) on a
time_t variable. So I also did not define it as int. Too many times I've
been burned by making minor adjustments such as that to the standard way
that C headers have been defined since ... as you say ... forever.

I didn't add any code, though, so I'm not sure to what you are referring by
saying I've added extra code. There's a call to the function, and a return.
And I think (Gads, I HOPE) you understand both of those!

I'd had a pointer in there for another purpose, and forgot to remove it for
this - is that what you mean?

But, even if you didn't know C or Unix, and didn't know about the time()
API, I can't see why you'd retrieve the timezone, et al... wouldn't you
just call the CEEUTC API? (OR CEELOCT for local?)

Those APIs, are similar to the C functions "time" and, as Chuck pointed out,
"gettimeofday." But they return number of seconds since some date in the
16th century. Imagine how complex it would have been if there were an
additional add (number of seconds in 177+ years) instruction there! Boggles
the mind! :)

Dennis Lovelady
http://www.linkedin.com/in/dennislovelady
--
"If only God would give me some clear sign! Like making a large deposit in
my name at a Swiss bank."
-- Woody Allen




As an Amazon Associate we earn from qualifying purchases.

This thread ...

Replies:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.