delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/2001/06/08/06:12:16

Date: Fri, 08 Jun 2001 12:12:02 +0300
From: "Eli Zaretskii" <eliz AT is DOT elta DOT co DOT il>
Sender: halo1 AT zahav DOT net DOT il
To: "Gorden" <gorden AT ms9 DOT url DOT com DOT tw>
Message-Id: <1659-Fri08Jun2001121202+0300-eliz@is.elta.co.il>
X-Mailer: Emacs 20.6 (via feedmail 8.3.emacs20_6 I) and Blat ver 1.8.9
CC: djgpp AT delorie DOT com
In-reply-to: <9fpr55$ode@netnews.hinet.net> (gorden@ms9.url.com.tw)
Subject: Re: maybe djgpp bug ?
References: <9fpr55$ode AT netnews DOT hinet DOT net>
Reply-To: djgpp AT delorie DOT com
Errors-To: nobody AT delorie DOT com
X-Mailing-List: djgpp AT delorie DOT com
X-Unsubscribes-To: listserv AT delorie DOT com

> From: "Gorden" <gorden AT ms9 DOT url DOT com DOT tw>
> Newsgroups: comp.os.msdos.djgpp
> Date: Fri, 8 Jun 2001 14:25:16 +0800
> 
> /* This Source Code Can't Setting New Time */
> void main(void)
> {
>   int result;
>   struct time ti;
>   static char string[256];
>   static struct tm the_time;
>   time_t current_time;
>   struct tm *t;
>   char *sptr;
> 
>   ti.ti_hour = 11;
>   ti.ti_min = 12;
>   settime(&ti);
> }

You don't set the ti_sec and ti_hund members to anything, so they are
garbled.  It is possible that the garbage makes the time invalid, for
example the ti_sec member might be larger than 59.

Try this:

void main(void)
{
  int result;
  struct time ti;
  static char string[256];
  static struct tm the_time;
  time_t current_time;
  struct tm *t;
  char *sptr;

  ti.ti_hour = 11;
  ti.ti_min = 12;
  ti.ti_sec = ti.ti_hund = 0;
  settime(&ti);
}

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019