Subversion Repositories Kolibri OS

Rev

Blame | Last modification | View Log | Download | RSS feed

  1. /* Copyright (C) 1995 DJ Delorie, see COPYING.DJ for details */
  2. #include <dos.h>
  3. #include <assert.h>
  4.  
  5. #define BCD_TO_BIN(val) ((val)=((val)&15) + ((val)>>4)*10)
  6.  
  7. void getdate( struct date *dateblk)
  8. {
  9.  unsigned long tmp;
  10.  __asm__ __volatile__("int $0x40":"=a"(tmp):"0"(29));
  11.  dateblk->da_year=2000+(tmp&0xff);
  12.  dateblk->da_mon=(tmp>>8)&0xff;
  13.  dateblk->da_day=(tmp>>16)&0xff;
  14.  BCD_TO_BIN(dateblk->da_year);
  15.  BCD_TO_BIN(dateblk->da_mon);
  16.  BCD_TO_BIN(dateblk->da_day);
  17. }
  18.