delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/2001/10/08/12:41:24

Message-ID: <3BC1D61D.2050708@maxi-tip.cz>
Date: Mon, 08 Oct 2001 18:36:45 +0200
From: Igor Bujna <igor DOT bujna AT maxi-tip DOT cz>
Organization: =?ISO-8859-2?Q?S=E1zkov=E1=20kancel=E1=F8?= Maxi-tip a.s.
User-Agent: Mozilla/5.0 (Windows; U; Win98; en-US; rv:0.9.4) Gecko/20010913
X-Accept-Language: cs, en-us
MIME-Version: 1.0
To: djgpp <djgpp AT delorie DOT com>
Subject: dostounix & unixtodos
X-Virus-Scanned: by AMaViS perl-11
Reply-To: djgpp AT delorie DOT com

Hallo,
i have on my borland 2 functions --> %subj% , and i this functions make 
for DJGPP.
Can you look at this functions is everything OK??.
Thank You

time_t dostounix (struct date *d, struct time *t)
{
  struct tm utm, *ptm;
  time_t the_time;

  the_time = time (0);
  ptm = localtime (&the_time);

  memset (&utm, '\0', sizeof (struct tm));
  memcpy ((void *) &utm, (void *) ptm, sizeof (struct tm));

  utm.tm_sec = t->ti_sec;
  utm.tm_min = t->ti_min;
  utm.tm_hour = t->ti_hour;
  utm.tm_mday = d->da_day;
  utm.tm_mon = d->da_mon;
  utm.tm_year = d->da_year;

  the_time = 0;
  the_time = mktime (&utm);
  return (the_time);
}

void
unixtodos (time_t the_time, struct date *d, struct time *t)
{
  struct tm utm, *ptm;

  memset (&utm, '\0', sizeof (struct tm));
  ptm = localtime (&the_time);
  memcpy ((void *) &utm, (void *) ptm, sizeof (struct tm));

  t->ti_sec = utm.tm_sec;
  t->ti_min = utm.tm_min;
  t->ti_hour = utm.tm_hour;

  d->da_day = utm.tm_mday;
  d->da_mon = utm.tm_mon;
  d->da_year = utm.tm_year;
}


- Raw text -


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