🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: borland.public.cppbuilder.nativeapi
Article #6836

Re: Time Weirdness

#6836
From: Bart
Date: Tue, 05 Apr 2005 07:20
62 lines
2235 bytes
PS:

It looks like a Daylight Savings issue but the DST is not changed at the 3th 
of april it was one week before at 27th of march. (In Europe)




"Bart" <Nomail@Spam.com> schreef in bericht 
news:42523a06$1@newsgroups.borland.com...
> Hi,
>
> When I compile the code from below the result is 2005-04-03 01:00. This is 
> strange because the result must be 2005-04-03 02:00
> When I alter the hour value the result is:
> hour :      result
> 1            2005-04-03 01:00            OK
> 2            2005-04-03 01:00            NOT OK !!!
> 3            2005-04-03 03:00            OK
>
> When I compile this under Microsoft Visual C++ This runs fine...
>
> Regards,
>
> Bart
>
>
> #include <time.h>
> #include <stdio.h>
> #include <conio.h>
>
> void main()
>
> {
>  char Env[80];
>  struct tm *time_now;
>  struct tm time_check;
>  time_t t;
>
>  long yy=2005;
>  long mm=4;
>  long dd=3;
>  long hh=2;
>  long nn=0;    // result must be 2005-04-03 02:00
>
>  time_check.tm_year = yy - 1900;
>  time_check.tm_mon  = mm - 1;
>  time_check.tm_mday = dd;
>  time_check.tm_hour = hh;
>  time_check.tm_min  = nn;
>  time_check.tm_sec  = 0;
>  time_check.tm_isdst = -1;
>
>   t         =  mktime(&time_check);
>   time_now  = localtime(&t);
>
>   strftime(Env, 80,"%y-%m-%d %H:%M:%S",time_now); printf("%s\n",Env);
>
>   getch();
> }
>
> 
Technical Details
Message-ID: <42523c33@newsgroups.borland.com>
Path: arc1-ca.pugleaf.net!g2news1.google.com!news1.google.com!news4.google.com!news.glorb.com!newsfeeds.ihug.co.nz!ihug.co.nz!newsgroups.borland.com!not-for-mail
References: <42523a06$1@newsgroups.borland.com>

Show Full Headers
Complete Article Headers
X-Google-Thread: 10cc67,8350982df1406f9,start
X-Google-Attributes: gid10cc67,public
X-Google-Language: ENGLISH,ASCII-7-bit
From: "Bart" <Nomail@Spam.com>
Newsgroups: borland.public.cppbuilder.nativeapi
References: <42523a06$1@newsgroups.borland.com>
Subject: Re: Time Weirdness
Date: Tue, 5 Apr 2005 09:20:00 +0200
Lines: 64
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2900.2180
X-RFC2646: Format=Flowed; Response
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2180
NNTP-Posting-Host: 194.171.5.81
Message-ID: <42523c33@newsgroups.borland.com>
X-Trace: newsgroups.borland.com 1112685619 194.171.5.81 (5 Apr 2005 00:20:19 -0800)
Path: arc1-ca.pugleaf.net!g2news1.google.com!news1.google.com!news4.google.com!news.glorb.com!newsfeeds.ihug.co.nz!ihug.co.nz!newsgroups.borland.com!not-for-mail