Main Page | Class List | Directories | File List | Class Members | File Members

utime.h File Reference

#include <time.h>

Go to the source code of this file.

Classes

struct  utimbuf

Defines

#define _UTIME_H   1

Functions

int utime (char *path, struct utimbuf *times)


Define Documentation

#define _UTIME_H   1
 

Definition at line 2 of file utime.h.


Function Documentation

int utime char *  path,
struct utimbuf times
 

Definition at line 153 of file tailor.c.

References DOSBase, errno, error(), and utimbuf::modtime.

Referenced by futimens().

00156 {
00157   struct DateStamp date;
00158   LONG error;
00159   time_t modtime;
00160 
00161   /* With Kickstart 1.3 setting the filedate could be done, I guess.
00162    * Maybe someone else will implement and test the code for this
00163    * case (I don't have Kickstart 1.3). */
00164   if (DOSBase->dl_lib.lib_Version < 37) return 0;
00165 
00166   /* Amiga dates are counted from 1. Jan 1978 as opposed to 1. Jan 1970
00167    * on Unix. Therefore we have to subtract 2922 days (8*365+2). We also
00168    * have to subtract the value of __timezone since SAS/C uses "CST+06"
00169    * as the default value. */
00170   modtime = times->modtime - __timezone;
00171   date.ds_Days = (modtime / 86400) - 2922;
00172   modtime %= 86400;
00173   date.ds_Minute = modtime / 60;
00174   modtime %= 60;
00175   date.ds_Tick = modtime * TICKS_PER_SECOND;
00176   error = SetFileDate (path, &date);
00177   if (error == DOSFALSE)
00178     {
00179       errno = EOSERR;
00180       return -1;
00181     }
00182   return 0;
00183 }


© sourcejam.com 2005-2008