home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
OS/2 Shareware BBS: 2 BBS
/
02-BBS.zip
/
BTMTSRC3.ZIP
/
FILETIME.C
< prev
next >
Wrap
Text File
|
1990-02-09
|
3KB
|
92 lines
/*--------------------------------------------------------------------------*/
/* Include files */
/*--------------------------------------------------------------------------*/
#ifndef OS_2
#error This Module only for OS/2
#endif
#include <ctype.h>
#include <errno.h>
#include <stdio.h>
#include <stdlib.h>
#include <fcntl.h>
#include <sys\types.h>
#include <sys\stat.h>
#include <io.h>
#define INCL_DOSFILEMGR
#include <os2.h>
#include <string.h>
#include <dos.h>
#include <time.h>
/*--------------------------------------------------------------------------*/
/* Static function declarations */
/*--------------------------------------------------------------------------*/
/* ... NONE ... */
/*--------------------------------------------------------------------------*/
/* Static variable definitions */
/*--------------------------------------------------------------------------*/
struct FileTimeBuf {
unsigned c_date; /* date of file creation */
unsigned c_time; /* time of file creation */
unsigned a_date; /* date of last access */
unsigned a_time; /* time of last access */
unsigned w_date; /* date of last write */
unsigned w_time; /* time of last write */
} ;
static struct FileTimeBuf TimeBuf;
/*--------------------------------------------------------------------------*/
/* External variable declarations */
/*--------------------------------------------------------------------------*/
/* ... NONE ... */
/*--------------------------------------------------------------------------*/
/* Locally defined globals */
/*--------------------------------------------------------------------------*/
/* ... NONE ... */
/*--------------------------------------------------------------------------*/
/* Local constants */
/*--------------------------------------------------------------------------*/
/* ... NONE ... */
/****************************************************************************/
/*--------------------------------------------------------------------------*/
/* set_fileinfo FOR PORTABILITY */
/*--------------------------------------------------------------------------*/
void set_fileinfo(int fh, unsigned date, unsigned time)
{
if ((time/2048) < (unsigned)(timezone/3600L)) {
TimeBuf.a_date = TimeBuf.w_date = TimeBuf.c_date = date-1;
TimeBuf.c_time = time+((unsigned)(86400-((unsigned)(timezone/3600L)*2048)));
TimeBuf.a_time = TimeBuf.w_time = TimeBuf.c_time;
} else {
TimeBuf.a_date = TimeBuf.w_date = TimeBuf.c_date = date;
TimeBuf.c_time = time-((unsigned)(timezone/3600L)*2048);
TimeBuf.a_time = TimeBuf.w_time = TimeBuf.c_time;
}
(void) DosSetFileInfo((HFILE) fh,
(USHORT) 1,
(PBYTE) &TimeBuf,
(USHORT) 12);
}
/*--------------------------------------------------------------------------*/
/* END OF FILE */
/*--------------------------------------------------------------------------*/