www.pudn.com > MP3+JPEG.rar > ftime.h


/****************************************************************/ 
/* 
 * wanghuidi,2004-09-23 
 */ 
 
#ifndef F_TIME_H 
#define F_TIME_H 
/*******************************************************************************/ 
 
typedef struct s_dosdate 
{ 
   UINT16 year; 
   UINT8 monthday , month; 
} dosdate_t; 
 
typedef struct s_dostime 
{ 
   UINT8 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 INT8* time_decode( UINT16 *tp , INT8 *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 INT8* date_decode( UINT16 *dp , INT8 *datec); 
 
extern void dosdate_decode(UWORD dos_date, UINT8 *pyear, UINT8 *pmonth, UINT8 *pday); 
extern void dostime_decode(UWORD dos_time, UINT8 *phour, UINT8 *pminite, UINT8 *psecond); 
 
 
/*******************************************************************************/ 
#ifdef Keil51 
extern INT8 *ctime( UINT32 *clock , INT8 *); 
#endif 
/*******************************************************************************/ 
#endif