| ftp.delorie.com/archives/browse.cgi | search |
| From: | "Rafael García" <rafael AT geninfor DOT com> |
| Newsgroups: | comp.os.msdos.djgpp |
| Subject: | RE: mktime(01/01/70;00:00:XX) |
| Date: | Thu, 15 Mar 2001 13:06:56 +0100 |
| Organization: | BT Tel. Netnews service (readers) |
| Lines: | 37 |
| Message-ID: | <3ab0b0d2$1@filemon.telecable.es> |
| References: | <Pine DOT SUN DOT 3 DOT 91 DOT 1010315110133 DOT 6041P-100000 AT is> |
| NNTP-Posting-Host: | filemon.telecable.es |
| Mime-Version: | 1.0 |
| X-Trace: | titan.bt.es 984658032 15585 212.89.0.4 (15 Mar 2001 12:07:12 GMT) |
| X-Complaints-To: | abuse AT bt DOT es |
| NNTP-Posting-Date: | 15 Mar 2001 12:07:12 GMT |
| X-Priority: | 3 |
| X-MSMail-Priority: | Normal |
| X-Newsreader: | Microsoft Outlook Express 5.00.2615.200 |
| X-MimeOLE: | Produced By Microsoft MimeOLE V5.00.2615.200 |
| X-Original-NNTP-Posting-Host: | cm05118.telecable.es |
| To: | djgpp AT delorie DOT com |
| DJ-Gateway: | from newsgroup comp.os.msdos.djgpp |
| Reply-To: | djgpp AT delorie DOT com |
> Please post a complete short example program that can be compiled, and
> which shows the problem.
#include <stdio.h>
#include <time.h>
int main() {
struct tm tm;
tm.tm_year=70; tm.tm_mon=0; tm.tm_mday=1;
tm.tm_hour=0; tm.tm_min=0; tm.tm_sec=0;
tm.tm_isdst=-1;
printf("%ld\n",(long)mktime(&tm));
return 0;
}
This should print 0 but it gives -1. And it fails with any second, until
minute 1.
> Also, what version of DJGPP do you have? The time routines in v2.03
> (djdev203.zip from the usual DJGPP sites) were enhanced to solve some
> of the problems you are describing.
YES! Thank you.
I have tried with a newer package and it is OK.
But I have tried also with Borland C 3.1 (the compiler I was using
previously) and it shows strange numbers too.
And... Linux... it gives strange numbers for 01/01/70 too. I don't
understand.
I'm confused about using this function. I don't plan to use it for past
dates, but I don't know if I can trust this technique... I 'll have to do
arithmetic with many many dates/times
| webmaster | delorie software privacy |
| Copyright © 2019 by DJ Delorie | Updated Jul 2019 |