You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@httpd.apache.org by sameer <sa...@c2.org> on 1996/06/21 01:35:14 UTC

help with time_t and struct tm?

	grr.. I'm trying to convert a struct tm into a time_t.

	I found mktime() on FreeBSD, but it isn't happy with
timezones. (Even though I set gmtoff in my struct tm properly.)
	Then I found out that mktime() isn't on SunOS. SunOS has
timelocal() and timegm().

	Any ideas on a preferred way to convert struct tm into a
time_t? Maybe I will snag the FreeBSD mktime source, find out where
the timezone stuff is broken, fix that and include it with my stuff I
am writing.

-- 
Sameer Parekh					Voice:   510-986-8770
Community ConneXion, Inc.			FAX:     510-986-8777
The Internet Privacy Provider
http://www.c2.net/				sameer@c2.net

Re: help with time_t and struct tm?

Posted by Michael Douglass <mi...@texas.net>.
On Thu, 20 Jun 1996, sameer wrote:

> 	grr.. I'm trying to convert a struct tm into a time_t.
>
> 	I found mktime() on FreeBSD, but it isn't happy with
> timezones. (Even though I set gmtoff in my struct tm properly.)
> 	Then I found out that mktime() isn't on SunOS. SunOS has
> timelocal() and timegm().
>
> 	Any ideas on a preferred way to convert struct tm into a
> time_t? Maybe I will snag the FreeBSD mktime source, find out where
> the timezone stuff is broken, fix that and include it with my stuff I
> am writing.

As far as I know it's these two:

     time_t timegm(tm)
     struct tm *tm;

     time_t timelocal(tm)
     struct tm *tm;


Michael Douglass
Texas Networking, Inc.


  "To be a saint is to be an exception; to be a true man is the rule.
   Err, fail, sin if you must, but be upright.  To sin as little as
   possible is the law for men; to sin not at all is a dream for angels."

              - Victor Hugo, "Les Miserables"