home *** CD-ROM | disk | FTP | other *** search
/ Programmer 7500 / MAX_PROGRAMMERS.iso / CLIPPER / MISC / EMXLIB8F.ZIP / EMX / LIB / IO / UTIME.C < prev    next >
Encoding:
C/C++ Source or Header  |  1993-01-02  |  654 b   |  29 lines

  1. /* utime.c (emx+gcc) -- Copyright (c) 1990-1993 by Eberhard Mattes */
  2.  
  3. #include <sys/emx.h>
  4. #include <sys/time.h>
  5. #include <sys/utime.h>
  6. #include <time.h>
  7.  
  8. int utime (const char *name, const struct utimbuf *times)
  9. {
  10.   struct timeval tv[2];
  11.  
  12.   if (times == NULL)
  13.     {
  14.       tv[0].tv_sec = tv[1].tv_sec = time (NULL);
  15.       tv[0].tv_usec = tv[1].tv_usec = 0;
  16.     }
  17.   else
  18.     {
  19.       tv[0].tv_sec = times->actime;
  20.       tv[0].tv_usec = 0;
  21.       tv[1].tv_sec = times->modtime;
  22.       tv[1].tv_usec = 0;
  23.     }
  24.   if (!_tzset_flag) tzset ();
  25.   tv[0].tv_sec -= timezone;
  26.   tv[1].tv_sec -= timezone;
  27.   return (__utimes (name, tv));
  28. }
  29.