home *** CD-ROM | disk | FTP | other *** search
/ CD Shareware Magazine 1996 December / CD_shareware_12-96.iso / DOS / Programa / AGSPC1B2.ZIP / UNIX2DOS.PPS < prev    next >
Encoding:
Text File  |  1996-07-29  |  967 b   |  36 lines

  1. ;----------------------------------------------------------------------------
  2. ; Copyright(C) 1996, The AEGiS Corporation
  3. ;----------------------------------------------------------------------------
  4. ;
  5. ; FUNCTION UnixToDos()
  6. ;
  7. ; Convert a UNIX date (count of seconds since midnight 01/01/70) to a
  8. ; DOS date (Date & Time)
  9. ;
  10. ;----------------------------------------------------------------------------
  11. #lib
  12. Declare Procedure UnixToDos(unsigned DateVal, Var Date NewDate, Var Time NewTime)
  13.  
  14. ;----------------------------------------------------------------------------
  15. ; UNIX Date&time -> DOSdate&time
  16. ;
  17. Procedure UnixToDos(unsigned DateVal, Var Date NewDate, Var Time NewTime)
  18. int tyear
  19. int tday
  20. int thour
  21. int tminute
  22. int tmonth
  23. unsigned tsecond
  24.  
  25. tsecond = DateVal % 86400
  26. DateVal = DateVal / 86400
  27.  
  28. tyear = (DateVal / 365)+2
  29.  
  30. tday = DateVal % 365 - tyear/4
  31. inc tday
  32.  
  33. NewDate = tday + (tyear+68) * 365 + 17
  34. NewTime = tsecond
  35. EndProc
  36.