www.pudn.com > OS.rar > ftime.h, change:2006-08-04,size:1956b


/****************************************************************/ 
/* 
 * wanghuidi,2004-09-23 
 */ 
 
#ifndef F_TIME_H 
#define F_TIME_H 
/*******************************************************************************/ 
 
 
typedef struct s_dosdate 
{ 
  unsigned short year; 
  unsigned char monthday, month; 
} dosdate_t; 
 
typedef struct s_dostime 
{ 
  unsigned char minute, hour, hundredth, second; 
} dostime_t; 
 
 
 
#define EPOCH_YEAR      1980    /* for Tues 1-1-80 epoch                */ 
 
#define DT_YEAR(d)      ((((d)>>9)&0x7f) + EPOCH_YEAR) 
#define DT_MONTH(d)     (((d)>>5)&0x0f) 
#define DT_DAY(d)       ((d)&0x1f) 
 
#define TM_HOUR(t)	(((t)>>11)&0x1f) 
#define TM_MIN(t)	(((t)>>5)&0x3f) 
#define TM_DEC(t)	((t)&0x1f) 
 
/*******************************************************************************/ 
/*Modified by WangHuidi,20040909*/ 
/* FAT time notation in the form of hhhh hmmm mmmd dddd (d = double second) */ 
 
extern char* time_decode(unsigned int *tp, char *timec); 
/*******************************************************************************/ 
/* FAT file date - takes the form of yyyy yyym mmmd dddd where physical */ 
/* year=1980+yyyyyy                                                     */ 
 
 
#define DT_ENCODE(m,d,y) ((((m)&0x0f)<<5)|((d)&0x1f)|(((y)&0x7f)<<9)) 
 
#define EPOCH_WEEKDAY   2       /* Tuesday (i. e.-  0 == Sunday)        */ 
#define EPOCH_MONTH     1       /* January                              */ 
#define EPOCH_DAY       1       /* 1 for January 1                      */ 
#define EPOCH_YEAR      1980    /* for Tues 1-1-80 epoch                */ 
 
/*Wanghuidi,20040909,*/ 
extern char* date_decode(unsigned int *dp, char *datec); 
/*******************************************************************************/ 
#ifdef Keil51 
extern char *ctime(unsigned long *clock, char *); 
#endif 
/*******************************************************************************/ 
#endif