timefun.c

来自「这是用Labwindows开发的一个RF test程序。 用于日本机种的组装后」· C语言 代码 · 共 84 行

C
84
字号
#include <utility.h>
#include <ansi_c.h>
#include "def.h"
char* GetSystemYear(char *str)
{
	char year[5];
	int status;
	struct DateType SystemDate;
	status = GetSystemDate (&SystemDate.month, &SystemDate.day, &SystemDate.year);	
	year[0]=SystemDate.year/1000+48;
	year[1]=(SystemDate.year-(year[0]-48)*1000)/100+48;
	year[2]=(SystemDate.year-(year[0]-48)*1000-(year[1]-48)*100)/10+48;
	year[3]=(SystemDate.year-(year[0]-48)*1000-(year[1]-48)*100-(year[2]-48)*10)+48;	
	year[4]='\0';
	strcpy(str,year);
	return str;
}

char* GetSystemMonth(char *str)
{
	char month[3];
	int status;
	struct DateType SystemDate;
	status = GetSystemDate (&SystemDate.month, &SystemDate.day, &SystemDate.year);	
	month[0]=SystemDate.month/10+48;
	month[1]=SystemDate.month-(month[0]-48)*10+48;
	month[2]='\0';
	strcpy(str,month);
	return str;
}

char* GetSystemDay(char *str)
{
	char day[3];
	int status;
	struct DateType SystemDate;
	status = GetSystemDate (&SystemDate.month, &SystemDate.day, &SystemDate.year);	
	day[0]=SystemDate.day/10+48;
	day[1]=SystemDate.day-(day[0]-48)*10+48;
	day[2]='\0';
	strcpy(str,day);
	return str;
}

char* GetSystemHour(char *str)
{
	char hour[3];
	int status;
	struct TimeType SystemTime;
	status = GetSystemTime (&SystemTime.hour,&SystemTime.minute,&SystemTime.second);
	hour[0]=SystemTime.hour/10+48;
	hour[1]=SystemTime.hour-(hour[0]-48)*10+48;
	hour[2]='\0';
	strcpy(str,hour);
	return str;
}

char* GetSystemMinute(char *str)
{
	char minute[3];
	int status;
	struct TimeType SystemTime;
	status = GetSystemTime (&SystemTime.hour,&SystemTime.minute,&SystemTime.second);
	minute[0]=SystemTime.minute/10+48;
	minute[1]=SystemTime.minute-(minute[0]-48)*10+48;
	minute[2]='\0';
	strcpy(str,minute);
	return str;
}

char* GetSystemSecond(char *str)
{
	char second[3];
	int status;
	struct TimeType SystemTime;
	status = GetSystemTime (&SystemTime.hour,&SystemTime.minute,&SystemTime.second);
	second[0]=SystemTime.second/10+48;
	second[1]=SystemTime.second-(second[0]-48)*10+48;
	second[2]='\0';
	strcpy(str,second);
	return str;
}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?