Borland C++ reference

unixtodos

raw OCR

Defined in header <dos.h>

Syntax

#include <dos.h>
void  unixtodosClong     time, struct date  *d, struct time  *t);

   DOS    UNIX    Windows   ANSI C   C++ only
     ■               ■

Remarks

unixtodos converts the UNIX-format time given in time to DOS format and fills in the date and time structures pointed to by d and t.

time must not represent a calender time earlier than Jan 1 1980 00:00:00.

Retum value

None.

See also

Example

#include <stdio.h>
#include <dos.h>

char *month[] - { "—  ", "Jan",  "Feb", "Mar", "Apr", "May", "Jun",
                  "Jul", "Aug",  "Sep", "Oct", "Nov", "Dec"};
Mefine  SECONDS_PER_DAY 86400L      /* number  of sees in one day /

struct date dt;
struct time tm;
int main(void)
{
   unsigned long val;

  ■ /* get today's date and time */
   getdate(&dt);
   gettime(&tm);
   printf("Today is %d %s %d\n", dt.da_day, month [dt.da_mon],
           dt.da_year);

   /* convert date and time to unix format  (number of sees since Jan 1,
      1970 V
   val = dostounix (&dt, &tm);

   /* subtract 42 days worth of seconds  */
   val -= (SECONDS_PER_DAY * 42);
   /* convert back to dos time and date  */
   unixtodos(val, &dt, fctm);
printf("42 days ago it was %d %s %d\n", dt.da_day,  month[dt.da_mon],
        dt.da_year);
return 0;

Differences from modern implementations

Nothing recorded yet.

Modern references

These are search links, not yet checked by hand.

Extraction notes

  • no Function section
  • no portability table