示例#1
0
void main( void )
{
    int      handle;
    unsigned date, time;

    if( _dos_open( "file", O_RDWR, &handle ) != 0 ) {
        printf( "Unable to open file\n" );
    } else {
        printf( "Open succeeded\n" );
        _dos_getftime( handle, &date, &time );
        printf( "The file was last modified on %d/%d/%d",
                MONTH(date), DAY(date), YEAR(date) );
        printf( " at %.2d:%.2d:%.2d\n",
                HOUR(time), MINUTE(time), SECOND(time) );
        /* set the time to 12 noon */
        time = (12 << 11) + (0 << 5) + 0;
        _dos_setftime( handle, date, time );
        _dos_getftime( handle, &date, &time );
        printf( "The file was last modified on %d/%d/%d",
                MONTH(date), DAY(date), YEAR(date) );
        printf( " at %.2d:%.2d:%.2d\n",
                HOUR(time), MINUTE(time), SECOND(time) );
        _dos_close( handle );
    }
}
示例#2
0
long timelib_parse_tz_cor(char **ptr)
{
        char *begin = *ptr, *end;
        long  tmp;

        while (isdigit(**ptr) || **ptr == ':') {
                ++*ptr;
        }
        end = *ptr;
        switch (end - begin) {
                case 1:
                case 2:
                        return HOUR(strtol(begin, NULL, 10));
                        break;
                case 3:
                case 4:
                        if (begin[1] == ':') {
                                tmp = HOUR(strtol(begin, NULL, 10)) + strtol(begin + 2, NULL, 10);
                                return tmp;
                        } else if (begin[2] == ':') {
                                tmp = HOUR(strtol(begin, NULL, 10)) + strtol(begin + 3, NULL, 10);
                                return tmp;
                        } else {
                                tmp = strtol(begin, NULL, 10);
                                return HOUR(tmp / 100) + tmp % 100;
                        }
                case 5:
                        tmp = HOUR(strtol(begin, NULL, 10)) + strtol(begin + 3, NULL, 10);
                        return tmp;
        }
        return 0;
}
示例#3
0
int
calculatesunlongitude30(int year, int degreeGMToffset, int *ichinesemonths)
{
	int m, d, h;
	double dec;
	double curL, prevL;
	int *pichinesemonths, *monthdays, *cumdays, i;
	int firstmonth330 = -1;

	cumdays = cumdaytab[isleap(year)];
	monthdays = mondaytab[isleap(year)];
	pichinesemonths = ichinesemonths;

	h = 0;
	sunpos(year - 1, 12, 31,
	    -24 * (degreeGMToffset / 360.0),
	    HOUR(h), MIN(h), SEC(h), 0.0, 0.0, &prevL, &dec);

	for (m = 1; m <= 12; m++) {
		for (d = 1; d <= monthdays[m]; d++) {
			for (h = 0; h < 4 * HOURSPERDAY; h++) {
				sunpos(year, m, d,
				    -24 * (degreeGMToffset / 360.0),
				    HOUR(h), MIN(h), SEC(h),
				    0.0, 0.0, &curL, &dec);
				if (curL < 180 && prevL > 180) {
					*pichinesemonths = cumdays[m] + d;
#ifdef DEBUG
printf("%04d-%02d-%02d %02d:%02d - %d %g\n",
    year, m, d, HOUR(h), MIN(h), *pichinesemonths, curL);
#endif
					    pichinesemonths++;
				} else {
					for (i = 0; i <= 360; i += 30)
						if (curL > i && prevL < i) {
							*pichinesemonths =
							    cumdays[m] + d;
#ifdef DEBUG
printf("%04d-%02d-%02d %02d:%02d - %d %g\n",
    year, m, d, HOUR(h), MIN(h), *pichinesemonths, curL);
#endif
							if (i == 330)
								firstmonth330 = *pichinesemonths;
							pichinesemonths++;
						}
				}
				prevL = curL;
			}
		}
	}
	*pichinesemonths = -1;
	return (firstmonth330);
}
示例#4
0
const char *timestr(int t)
{
    static char s[80];

    if (DAY(t) > 0)
	(void) sprintf(s, "%dd+%02dhrs", DAY(t), HOUR(t));
    else if (HOUR(t) > 0)
	(void) sprintf(s, "%d:%02d:%02d", HOUR(t), MIN(t), SEC(t));
    else if (MIN(t) > 0)
	(void) sprintf(s, "%d:%02d", MIN(t), SEC(t));
    else if (SEC(t) > 0)
	(void) sprintf(s, ":%02d", SEC(t));
    else
	*s = '\0';

    return s;
}
示例#5
0
文件: main.c 项目: Requaos/harvey
/*
 * process to copy dump blocks from
 * cache to worm. it runs flat out when
 * it gets work, but only looks for
 * work every 10 seconds.
 */
void
wormcopy(void *)
{
	int f, dorecalc = 1;
	Timet dt, t = 0, nddate = 0, ntoytime = 0;
	Filsys *fs;

	for (;;) {
		if (dorecalc) {
			dorecalc = 0;
			t = time(nil);
			nddate = nextdump(t);		/* chatters */
			ntoytime = time(nil);
		}
		dt = time(nil) - t;
		if(dt < 0 || dt > MINUTE(100)) {
			if(dt < 0)
				print("time went back\n");
			else
				print("time jumped ahead\n");
			dorecalc = 1;
			continue;
		}
		t += dt;
		f = 0;
		if(t > ntoytime)
			ntoytime = time(nil) + HOUR(1);
		else if(t > nddate) {
			if(!conf.nodump) {
				print("automatic dump %T\n", t);
				for(fs=filsys; fs->name; fs++)
					if(fs->dev->type == Devcw)
						cfsdump(fs);
			}
			dorecalc = 1;
		} else {
			rlock(&mainlock);
			for(fs=filsys; fs->name; fs++)
				if(fs->dev->type == Devcw)
					f |= dumpblock(fs->dev);
			runlock(&mainlock);
			if(!f)
				delay(10000);
			wormprobe();
		}
	}
}
示例#6
0
/*
   显示item 9个字节的头
   uint32_t	id;        单增序号
   MYTIME		datetime;  收到的时间
   uint8_t	len;       长度

   第11字节是flag,
   数据从第12字节开始,汉字 12x12 每行10个 ASC 0612 每行 20个

 */
static void display_item( )
{
	char	buf1[32], buf2[32];
	uint8_t len;

	if( item_pos >= textmsg_count )
	{
		rt_kprintf("\n%d>item_pos >= textmsg_count");
		return;                     /*item_pos=0可以环回*/
	}

	/*item_pos 范围[0..textmsg_count-1]*/
	if( item_pos_read != item_pos ) /*有变化,要读*/
	{
		jt808_textmsg_get( item_pos, &textmsg );
		item_pos_read = item_pos;
	}

	lcd_fill( 0 );
	sprintf( buf1, "[%02d] %02d/%02d/%02d %02d:%02d",
	         item_pos + 1,
	         YEAR( textmsg.datetime ),
	         MONTH( textmsg.datetime ),
	         DAY( textmsg.datetime ),
	         HOUR( textmsg.datetime ),
	         MINUTE( textmsg.datetime ) );

	split_lines_count = 0;
	analy_textmsg( );
	//len = my_strncpy( buf2, (char*)( textmsg.body ), 20 ); /*获取第一行*/
	len = my_strncpy( buf2, (char*)( textmsg.body + split_lines[0] ), 20 );		/*获取第一行*/
	if( len )
	{
		lcd_text12( 0, 4, buf1, strlen( buf1 ), LCD_MODE_SET );
		lcd_text12( 0, 16, buf2, len, LCD_MODE_SET );
	}
	lcd_update_all( );
}
示例#7
0
char *TimeFormat(dword DateTime, byte Sec, eTimeStampFormat TimeStampFormat)
{
  static char           sTimeStamp [25];      //Log adds a SPACE to sTimeStamp. Do not make it too small!
  word                  Mjd, Year;
  byte                  Month, Day, WeekDay, Hour, Min;

  Mjd  = MJD    (DateTime);
  Hour = HOUR   (DateTime);
  Min  = MINUTE (DateTime);
  TAP_ExtractMjd (Mjd, &Year, &Month, &Day, &WeekDay);

  switch (TimeStampFormat)
  {
    case TIMESTAMP_HM     : TAP_SPrint (sTimeStamp, "%02d:%02d", Hour, Min); break;
    case TIMESTAMP_HMS    : TAP_SPrint (sTimeStamp, "%02d:%02d:%02d", Hour, Min, Sec); break;
    case TIMESTAMP_YMD    : TAP_SPrint (sTimeStamp, "%02d-%02d-%02d", Year, Month, Day); break;
    case TIMESTAMP_YMDHM  : TAP_SPrint (sTimeStamp, "%04d-%02d-%02d %02d:%02d", Year, Month, Day, Hour, Min); break;
    case TIMESTAMP_YMDHMS : TAP_SPrint (sTimeStamp, "%04d-%02d-%02d %02d:%02d:%02d", Year, Month, Day, Hour, Min, Sec); break;
    case TIMESTAMP_FNYMDHM: TAP_SPrint (sTimeStamp, "%04d%02d%02d_%02d%02d", Year, Month, Day, Hour, Min); break;
    default               : sTimeStamp [0] = '\0';
  }

  return sTimeStamp;
}
示例#8
0
char *TimeFormat(dword DateTime, byte Sec, eTimeStampFormat TimeStampFormat, char *Result)
{
  TRACEENTER();

  word                  Mjd, Year;
  byte                  Month, Day, WeekDay, Hour, Min;

  if(Result)
  {
    Mjd  = MJD    (DateTime);
    Hour = HOUR   (DateTime);
    Min  = MINUTE (DateTime);
    TAP_ExtractMjd(Mjd, &Year, &Month, &Day, &WeekDay);
    if(Mjd == 0)
    {
      Year = 0;
      Month = 0;
      Day = 0;
      WeekDay = 0;
    }

    switch(TimeStampFormat)
    {
      case TIMESTAMP_HM     : TAP_SPrint(Result, "%02d:%02d", Hour, Min); break;
      case TIMESTAMP_HMS    : TAP_SPrint(Result, "%02d:%02d:%02d", Hour, Min, Sec); break;
      case TIMESTAMP_YMD    : TAP_SPrint(Result, "%02d-%02d-%02d", Year, Month, Day); break;
      case TIMESTAMP_YMDHM  : TAP_SPrint(Result, "%04d-%02d-%02d %02d:%02d", Year, Month, Day, Hour, Min); break;
      case TIMESTAMP_YMDHMS : TAP_SPrint(Result, "%04d-%02d-%02d %02d:%02d:%02d", Year, Month, Day, Hour, Min, Sec); break;
      case TIMESTAMP_FNYMDHM: TAP_SPrint(Result, "%04d%02d%02d_%02d%02d", Year, Month, Day, Hour, Min); break;
      default               : Result[0] = '\0'; break;
    }
  }

  TRACEEXIT();
  return Result;
}
示例#9
0
void
fequinoxsolstice(int year, double UTCoffset, double *equinoxdays, double *solsticedays)
{
	double dec, prevdec, L;
	int h, d, prevangle, angle;
	int found = 0;

	double decleft, decright, decmiddle;
	int dial, s;

	int *cumdays;
	cumdays = cumdaytab[isleap(year)];

	/*
	 * Find the first equinox, somewhere in March:
	 * It happens when the returned value "dec" goes from
	 * [350 ... 360> -> [0 ... 10]
	 */
	for (d = 18; d < 31; d++) {
		/* printf("Comparing day %d to %d.\n", d, d+1); */
		sunpos(year, 3, d, UTCoffset, 0, 0, 0, 0.0, 0.0, &L, &decleft);
		sunpos(year, 3, d + 1, UTCoffset, 0, 0, 0, 0.0, 0.0,
		    &L, &decright);
		/* printf("Found %g and %g.\n", decleft, decright); */
		if (SIGN(decleft) == SIGN(decright))
			continue;

		dial = SECSPERDAY;
		s = SECSPERDAY / 2;
		while (s > 0) {
			/* printf("Obtaining %d (%02d:%02d)\n",
			    dial, SHOUR(dial), SMIN(dial)); */
			sunpos(year, 3, d, UTCoffset,
			    SHOUR(dial), SMIN(dial), SSEC(dial),
			    0.0, 0.0, &L, &decmiddle);
			/* printf("Found %g\n", decmiddle); */
			if (SIGN(decleft) == SIGN(decmiddle)) {
				decleft = decmiddle;
				dial += s;
			} else {
				decright = decmiddle;
				dial -= s;
			}
			/*
			 printf("New boundaries: %g - %g\n", decleft, decright);
			*/

			s /= 2;
		}
		equinoxdays[0] = 1 + cumdays[3] + d + (dial / FSECSPERDAY);
		break;
	}

	/* Find the second equinox, somewhere in September:
	 * It happens when the returned value "dec" goes from
	 * [10 ... 0] -> <360 ... 350]
	 */
	for (d = 18; d < 31; d++) {
		/* printf("Comparing day %d to %d.\n", d, d+1); */
		sunpos(year, 9, d, UTCoffset, 0, 0, 0, 0.0, 0.0, &L, &decleft);
		sunpos(year, 9, d + 1, UTCoffset, 0, 0, 0, 0.0, 0.0,
		    &L, &decright);
		/* printf("Found %g and %g.\n", decleft, decright); */
		if (SIGN(decleft) == SIGN(decright))
			continue;

		dial = SECSPERDAY;
		s = SECSPERDAY / 2;
		while (s > 0) {
			/* printf("Obtaining %d (%02d:%02d)\n",
			    dial, SHOUR(dial), SMIN(dial)); */
			sunpos(year, 9, d, UTCoffset,
			    SHOUR(dial), SMIN(dial), SSEC(dial),
			    0.0, 0.0, &L, &decmiddle);
			/* printf("Found %g\n", decmiddle); */
			if (SIGN(decleft) == SIGN(decmiddle)) {
				decleft = decmiddle;
				dial += s;
			} else {
				decright = decmiddle;
				dial -= s;
			}
			/*
			printf("New boundaries: %g - %g\n", decleft, decright);
			*/

			s /= 2;
		}
		equinoxdays[1] = 1 + cumdays[9] + d + (dial / FSECSPERDAY);
		break;
	}

	/*
	 * Find the first solstice, somewhere in June:
	 * It happens when the returned value "dec" peaks
	 * [40 ... 45] -> [45 ... 40]
	 */
	found = 0;
	prevdec = 0;
	prevangle = 1;
	for (d = 18; d < 31; d++) {
		for (h = 0; h < 4 * HOURSPERDAY; h++) {
			sunpos(year, 6, d, UTCoffset, HOUR(h), MIN(h), SEC(h),
			    0.0, 0.0, &L, &dec);
			angle = ANGLE(prevdec, dec);
			if (prevangle != angle) {
#ifdef NOTDEF
				DEBUG2(year, 6, d, HOUR(h), MIN(h),
				    prevdec, dec, prevangle, angle);
#endif
				solsticedays[0] = 1 + cumdays[6] + d +
				    ((h / 4.0) / 24.0);
				found = 1;
				break;
			}
			prevdec = dec;
			prevangle = angle;
		}
		if (found)
			break;
	}

	/*
	 * Find the second solstice, somewhere in December:
	 * It happens when the returned value "dec" peaks
	 * [315 ... 310] -> [310 ... 315]
	 */
	found = 0;
	prevdec = 360;
	prevangle = -1;
	for (d = 18; d < 31; d++) {
		for (h = 0; h < 4 * HOURSPERDAY; h++) {
			sunpos(year, 12, d, UTCoffset, HOUR(h), MIN(h), SEC(h),
			    0.0, 0.0, &L, &dec);
			angle = ANGLE(prevdec, dec);
			if (prevangle != angle) {
#ifdef NOTDEF
				DEBUG2(year, 12, d, HOUR(h), MIN(h),
				    prevdec, dec, prevangle, angle);
#endif
				solsticedays[1] = 1 + cumdays[12] + d +
				    ((h / 4.0) / 24.0);
				found = 1;
				break;
			}
			prevdec = dec;
			prevangle = angle;
		}
		if (found)
			break;
	}

	return;
}
示例#10
0
static void display( void )
{
	uint16_t			pic_page_start; /*每四个图片记录为一个page*/
	uint8_t				buf[32], buf_time[16];
	uint16_t			i;
	MYTIME				t;
	TypeDF_PackageHead	* pcurrhead;

	lcd_fill( 0 );
	switch( scr_mode )
	{
		case SCR_PHOTO_MENU:
			pos &= 0x01;
			lcd_text12( 5, 4, "1.图片记录", 10, 3 - pos * 2 );
			lcd_text12( 5, 18, "2.拍照上传", 10, pos * 2 + 1 );
			break;
		case SCR_PHOTO_SELECT_ITEM:
			if( pic_count ) /*有图片*/
			{
				if( pos >= pic_count )
				{
					pos = 0;
				}
				if( pos < 0 )
				{
					pos = pic_count - 1;
				}
				pic_page_start = pos & 0xFFFC; /*每4个1组*/
				for( i = pic_page_start; i < pic_page_start + 4; i++ )
				{
					if( i >= pic_count )
					{
						break;
					}

					pcurrhead	= (TypeDF_PackageHead*)( pHead + i * sizeof( TypeDF_PackageHead ) );
					t			= pcurrhead->Time;

					sprintf( buf, "%02d>%02d-%02d-%02d %02d:%02d:%02d",
					         i+1, YEAR( t ), MONTH( t ), DAY( t ), HOUR( t ), MINUTE( t ), SEC( t ));
					if( i == pos )
					{
						lcd_asc0608( 0, 8 * ( i & 0x03 ), buf, LCD_MODE_INVERT );
					} else
					{
						lcd_asc0608( 0, 8 * ( i & 0x03 ), buf, LCD_MODE_SET );
					}
				}
			}else /*没有图片*/
			{
				lcd_text12( 25, 12, "没有图片记录", 12, LCD_MODE_SET );
			}
			break;
		case SCR_PHOTO_SELECT_DETAILED:/*显示图片详细信息*/
			pcurrhead	= (TypeDF_PackageHead*)( pHead + pos * sizeof( TypeDF_PackageHead ) );
			t			= pcurrhead->Time;
			
			sprintf( buf, "%02d-%02d-%02d %02d:%02d:%02d",
					 YEAR( t ), MONTH( t ), DAY( t ), HOUR( t ), MINUTE( t ), SEC( t ));
			lcd_asc0608( 0, 0, buf, LCD_MODE_SET );

			sprintf(buf,"chn=%d trig=%d del=%d",pcurrhead->Channel_ID,pcurrhead->TiggerStyle,pcurrhead->State);
			lcd_asc0608( 0, 8, buf, LCD_MODE_SET );
			sprintf(buf,"size=%d",pcurrhead->Len-64);
			lcd_asc0608( 0, 16, buf, LCD_MODE_SET );
			lcd_asc0608(70,24,"usb",LCD_MODE_SET);
			lcd_asc0608(104,24,"rep",LCD_MODE_SET);
		
			break;
		case SCR_PHOTO_TAKE:
			lcd_text12( 20, 12, "拍照上传中...", 12, LCD_MODE_SET );
			break;
	}
	lcd_update_all( );
}
示例#11
0
    { "fifth",		tUNUMBER,	5 },
    { "sixth",		tUNUMBER,	6 },
    { "seventh",	tUNUMBER,	7 },
    { "eighth",		tUNUMBER,	8 },
    { "ninth",		tUNUMBER,	9 },
    { "tenth",		tUNUMBER,	10 },
    { "eleventh",	tUNUMBER,	11 },
    { "twelfth",	tUNUMBER,	12 },
    { "ago",		tAGO,	1 },
    { NULL }
};

/* The timezone table. */
/* Some of these are commented out because a time_t can't store a float. */
static TABLE const TimezoneTable[] = {
    { "gmt",	tZONE,     HOUR( 0) },	/* Greenwich Mean */
    { "ut",	tZONE,     HOUR( 0) },	/* Universal (Coordinated) */
    { "utc",	tZONE,     HOUR( 0) },
    { "wet",	tZONE,     HOUR( 0) },	/* Western European */
    { "bst",	tDAYZONE,  HOUR( 0) },	/* British Summer */
    { "wat",	tZONE,     HOUR( 1) },	/* West Africa */
    { "at",	tZONE,     HOUR( 2) },	/* Azores */
#if	0
    /* For completeness.  BST is also British Summer, and GST is
     * also Guam Standard. */
    { "bst",	tZONE,     HOUR( 3) },	/* Brazil Standard */
    { "gst",	tZONE,     HOUR( 3) },	/* Greenland Standard */
#endif
#if 0
    { "nft",	tZONE,     HOUR(3.5) },	/* Newfoundland */
    { "nst",	tZONE,     HOUR(3.5) },	/* Newfoundland Standard */
示例#12
0
#define	USE_TABLE	1
#endif

#if	USE_TABLE
static int usetable = 1;

typedef struct table {
	const char *tz_name;
	const int daylight;
	const long zoneoffset;
} TABLE;

#define HOUR(x)	((x) * 60*60)

static TABLE TimezoneTable[] = {
	{"GMT", 0,	HOUR(0) },	/* Greenwich Mean */
	{"BST", 60*60,	HOUR(0) },	/* British Summer */
	{"WAT", 0,	HOUR(1) },	/* West Africa */
	{"AT", 0,	HOUR(2) },	/* Azores */
	{"BST", 0,	HOUR(3) },	/* Brazil Standard */
	{"NFT", 0,	HOUR(3.5) },	/* Newfoundland */
	{"NDT", 60*60,	HOUR(3.5) },	/* Newfoundland Daylight */
	{"AST", 0,	HOUR(4) },	/* Atlantic Standard */
	{"ADT", 60*60,	HOUR(4) },	/* Atlantic Daylight */
	{"EST", 0,	HOUR(5) },	/* Eastern Standard */
	{"EDT", 60*60,	HOUR(5) },	/* Eastern Daylight */
	{"CST", 0,	HOUR(6) },	/* Central Standard */
	{"CDT", 60*60,	HOUR(6) },	/* Central Daylight */
	{"MST", 0,	HOUR(7) },	/* Mountain Standard */
	{"MDT", 60*60,	HOUR(7) },	/* Mountain Daylight */
	{"PST", 0,	HOUR(8) },	/* Pacific Standard */
示例#13
0
void power_switch(UINT32 mode)
{
	unsigned long keycode;
	SYSTEM_DATA* sys_data;
	UINT32 vkey;
	UINT32 times = 0,display_type=0;
	date_time dt;
	UINT32 hh,mm,ss;
	char time_str[10];
	struct pan_key key_struct;
	UINT32 timer;
	struct sf_panel_attr panel_attr;
/*alfred.wu 1.0版本的MCU程序因为待机时间不能超过256小时*/
#ifdef MCUSTANDBY
	struct sf_panel_time time;
	date_time sRecentTime;	
	UINT32 nDurationTime = 0;
	UINT32 nYear = 0;
	UINT32 nMonth = 0;
	UINT32 nDay = 0;
	UINT32 nHour = 0;
	UINT32 nMin = 0;
	UINT32 nSec = 0;
	struct sf_standby_param standby_param;
	/*Note: For the limited memory size of MCU, if using led panel, the maximum IR key num is 5 and for vfd panel the size is 2. */
	struct sf_power_ir_key ir_key[] = \
		{
#ifdef RC04_A
			{0x007f, 0x1c}, /*RC04_A*/
#endif
#ifdef RC09_A
			{0x00FD, 0x1A}, /*RC09_A*/
#endif
#ifdef RC11_A
			{0x00ff, 0x54}, /*RC11_A*/	
#endif
#ifdef RC19_D
			{0x01fe, 0x00}, /*RC11_A*/	
#endif
#ifdef RC01_A_02
			{0x807f, 0x0a}, /*RC01_A_02*/	
#endif
#ifdef ORDER_GZ1010001
			{0x007f, 0x1c}, /*RC04_A*/
#else
			{0x007f, 0x0a}, /*RC01_A*/
#endif
			{0x01FE, 0x01}, /*REMOTE02420100*/
			{0x06FB, 0x0E}, /*ALI_RCU_60_KEY*/
		};
#endif
	sys_data = sys_data_get();
	sys_data->bstandmode = 1;
	sys_data_save(1);
	system_state = SYS_STATE_POWER_OFF;

/*Archer:The following process is unnessary when using mcu standby resolution.*/
#if 0
	power_off_process();
	power_off_process2();
#endif
#ifndef MCUSTANDBY
    if(mode != 1)
		key_pan_display("off ", 4);
	key_pan_display_standby(1);
	key_pan_display_lock(0);

    api_standby_led_onoff(TRUE);
#else
#if 0
    get_local_time(&dt);
    nDurationTime = api_get_recently_timer();
	POWER_PRINTF("nDurationTime = 0x%x\n",nDurationTime);
	if(0 != nDurationTime)
	{
		sRecentTime.year = YEAR(nDurationTime);
		sRecentTime.month= MONTH(nDurationTime);
		sRecentTime.day= DAY(nDurationTime);
		sRecentTime.hour= HOUR(nDurationTime);
		sRecentTime.min= MIN(nDurationTime);
		sRecentTime.sec= SEC(nDurationTime);

		POWER_PRINTF("RecentTime:%d-%d-%d %d:%d:%d\n",sRecentTime.year,sRecentTime.month,\
							sRecentTime.day, sRecentTime.hour,sRecentTime.min,sRecentTime.sec);
		
		get_time_offset(&dt,&sRecentTime,&nDay,&nHour,&nMin,&nSec);
		//standby_param.standby_time_sec = nHour*60*60+nMin*60;
		standby_param.standby_time_sec = 60;
		POWER_PRINTF("standby:hour:%d, minute:%d, total secs:%d\n",nHour,nMin, standby_param.standby_time_sec);
		//pan_set_standby_time((struct pan_device*)dev_get_by_id(HLD_DEV_TYPE_PAN,0),&sPanelTime);
	}
	else
	{
		POWER_PRINTF("no timer\n");
	}
#endif

	//pan_display(g_pan_dev, "        ", 8);//albert.li del 2011.1.25
	
	/*albert.li add 2011.1.25*/
	get_local_time(&dt);
	time.hour = dt.hour;
	time.min= dt.min;
	time.sec = dt.sec;
#ifndef FAKE_STANDBY	

	sf_panel_clear();
	reset_sf_panel_all_led();
	/*albert.li add end*/

	sf_panel_display_time(&time);

	sf_panel_term();
#else	
	pan_io_control(g_pan_dev, PAN_DRIVER_GET_ATTRIBUTE, &panel_attr);
	if (panel_attr.type == SF_PANEL_TYPE_LED)
	{
		pan_display(g_pan_dev,"OFF ", 4);
	}
	else
	{
		pan_display(g_pan_dev,"STANDBY", 7);
	}
#endif	
	power_off_process();
	//S5PanelStandby(g_pan_dev,(const)&sPanIRSpecialKey,2);//guop edit
	standby_param.ir_key_num = sizeof(ir_key)/sizeof(struct sf_power_ir_key);
	standby_param.ir_key_list = ir_key;
	standby_param.standby_time_sec = 0;
#ifndef FAKE_STANDBY
	sf_power_down(&standby_param);
#else	 //zhouxp fake standby
	{
		while (1)
		{
			ControlMsg_t msg;
			times++;
			times = times % 100; 
			osal_delay(5000);
						
			vkey = V_KEY_NULL;
			if(key_get_key(&key_struct,0))
			{
				keycode = scan_code_to_msg_code(&key_struct);
				ap_hk_to_vk(0, keycode, &vkey);
			}
			else
				keycode = PAN_KEY_INVALID;
			if(vkey == V_KEY_POWER)
			{
				power_on_process();
			}
			ap_receive_msg( &msg, 10);
			libc_printf("got msg type=%d\n",msg.msgType);
			if(msg.msgType== CTRL_MSG_SUBTYPE_CMD_TIMER_WAKEUP)
				power_on_process();
				
		}
	}
#endif		

#endif
#ifndef MCUSTANDBY
	if(1)	/* Real Standby*//*alfred.wu ali的IC真待机处理流程在MCUSTANDBY后不会执行*/
	{
		UINT32	cur_time, target_time;

		get_local_time(&dt);
		pan_close(g_pan_dev);
        timer = api_get_recently_timer();
		// disable interrupt
		osal_interrupt_disable();

		cur_time = (dt.sec & 0x3F ) | ((dt.min & 0x3F )<<6)  | ((dt.hour & 0x1F )<<12) | ((dt.day & 0x1F)<<17)
			| ((dt.month & 0xF) << 22) | (((dt.year % 100) & 0x3F)<<26);

		sys_ic_enter_standby(timer, cur_time);
		// enable interrupt
		osal_interrupt_enable();
	}	
    
     
    while (1)
    {
		times++;
		times = times % 100; 
		osal_delay(5000);
    				
		if(times==0)
		{
			//get_cur_time(&hh,&mm,&ss);
			get_local_time(&dt);
			hh = dt.hour;
			mm = dt.min;

			if(display_type==0)
			    sprintf(time_str,"%02d%02d ",hh,mm);
			else
				sprintf(time_str,"%02d.%02d",hh,mm);

			key_pan_display(time_str, 5);
			display_type++;
			display_type %= 2;
		}
		
		vkey = V_KEY_NULL;
		if(key_get_key(&key_struct,0))
		{
			keycode = scan_code_to_msg_code(&key_struct);
			ap_hk_to_vk(0, keycode, &vkey);
		}
		else
			keycode = PAN_KEY_INVALID;
		if(vkey == V_KEY_POWER)
		{
			power_on_process();
		}
	}
#endif	
}