代码拉取完成,页面将自动刷新
同步操作将从 icesky1stm/Xipkpublib_Update 强制同步,此操作会覆盖自 Fork 仓库以来所做的任何修改,且无法恢复!!!
确定后同步将在后台操作,完成时将刷新页面,请耐心等待。
/*******************************************************
* 公 司: 大连同方软银科技有限公司
* 程 序 名: getDateTimeFormat.c
* 程序功能: 获取渠道当前日期
* 输入参数:
* xipId 渠道标识
* 输出参数:
* object 日期
* format 日期格式
* 返 回 值:
*
* 作 者: yangF
* 开发日期: 2008/1
* 修 改 人:
* 修改日期:
*******************************************************/
#include "kernel/syspub.h"
#include "kernel/xipcmstc.h"
#include "kernel/tabincl/xip_sysdate_c.h"
void getDateTimeFormat( char* xipId , char* object, char* format,char *replyCode)
{
/*
YYYY,MM,DDD, hh,mm,ss;
format as "MM/DD/YYYY hh:mm:ss" , "MM-DD-YY", "hh-mm-ss",etc.
*/
int YearPos = -1, YearLen = 0 ;
int MonPos = -1, MonLen = 0 ;
int DayPos = -1, DayLen = 0 ;
int HourPos = -1, HourLen = 0 ;
int MinPos = -1, MinLen = 0;
int SecPos = -1, SecLen = 0;
int fmterror = 0, i;
char tradeDate[9];
char Year[5];
char Month[3];
char mDay[3];
char Hour[3];
char Minute[3];
char Second[3];
long tradeDateL = 0 ;
int HourI = 0;
int MinuteI = 0;
int SecondI = 0;
int ret = 0;
memset(tradeDate,0x00,sizeof(tradeDate));
memset(Year,0x00,sizeof(Year));
memset(Month,0x00,sizeof(Month));
memset(mDay,0x00,sizeof(mDay));
memset(Hour,0x00,sizeof(Hour));
memset(Minute,0x00,sizeof(Minute));
memset(Second,0x00,sizeof(Second));
ret = GetTradeDate(xipId,&tradeDateL,replyCode);
if(ret<0){
XIPLOG("E", "CALL getDateTimeFormat ERR = [%d]", ret);
}
sprintf(tradeDate,"%.8ld",tradeDateL);
memcpy( Year, &tradeDate[0],sizeof(Year)-1 );
Year[4]='\0';
memcpy( Month, &tradeDate[4],sizeof(Month)-1 );
Month[2]='\0';
memcpy( mDay, &tradeDate[6],sizeof(mDay)-1 );
mDay[2]='\0';
GetSysTime(&HourI, &MinuteI, &SecondI);
sprintf(Hour,"%.2d",HourI);
sprintf(Minute,"%.2d",MinuteI);
sprintf(Second,"%.2d",SecondI);
for ( i = 0; i < strlen(format); i++ ) {
switch ( format[i] ) {
case 'Y' :
if ( YearPos < 0 ) {
YearPos = i;
YearLen++;
}
else {
if ( i == ( YearPos + YearLen ) ) {
YearLen++;
}
else
fmterror = 1;
}
if ( YearLen > 4 )
fmterror = 1;
break;
case 'M' :
if ( MonPos < 0 ) {
MonPos = i;
MonLen++;
}
else {
if ( i == ( MonPos + MonLen ) ) {
MonLen++;
}
else
fmterror = 1;
}
if ( MonLen > 2 )
fmterror = 1;
break;
case 'D' :
if ( DayPos < 0 ) {
DayPos = i;
DayLen++;
}
else {
if ( i == ( DayPos+ DayLen ) ) {
DayLen++;
}
else
fmterror = 1;
}
if ( DayLen > 2 )
fmterror = 1;
break;
case 'h' :
if ( HourPos < 0 ) {
HourPos = i;
HourLen++;
}
else {
if ( i == ( HourPos + HourLen ) ){
HourLen++;
}
else
fmterror = 1;
}
if ( HourLen > 2 )
fmterror = 1;
break;
case 'm' :
if ( MinPos < 0 ) {
MinPos = i;
MinLen++;
}
else {
if ( i == ( MinPos + MinLen ) ){
MinLen++;
}
else
fmterror = 1;
}
if ( MinLen > 2 )
fmterror = 1;
break;
case 's' :
if ( SecPos < 0 ) {
SecPos = i;
SecLen++;
}
else {
if ( i == ( SecPos + SecLen ) ){
SecLen++;
}
else
fmterror = 1;
}
if ( SecLen > 2 )
fmterror = 1;
break;
default :
break;
}
if ( fmterror )
break;
}
if ( fmterror ) {
memset(object,0x00,1);
return;
}
strcpy(object,format);
if ( YearPos >= 0 ) {
if ( YearLen == 4 ) {
memcpy(object+YearPos,Year,4);
}
else if ( YearLen == 2 ) {
memcpy(object+YearPos,Year+2,2);
}
else {
memset(object,0x00,1);
return;
}
}
if ( ( MonPos >= 0 ) && ( MonLen == 2 ) )
memcpy(object+MonPos,Month,2);
if ( ( DayPos >= 0 ) && ( DayLen == 2 ) )
memcpy(object+DayPos,mDay,2);
if ( ( HourPos >= 0 ) && ( HourLen == 2 ) )
memcpy(object+HourPos,Hour,2);
if ( ( MinPos >= 0 ) && ( MinLen == 2 ) )
memcpy(object+MinPos,Minute,2);
if ( ( SecPos >= 0 ) && ( SecLen == 2 ) )
memcpy(object+SecPos,Second,2);
/*sprintf(buffer,"%.4d %.2d/%.2d/%.2d:%.2d:%.2d",clock->tm_year+1900,clock->tm_mon+1,
clock->tm_mday,clock->tm_hour,clock->tm_min,clock->tm_sec);*/
}
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。