int clip_PG_OUT_DATETIME(ClipMachine* mp){ PG_ROWSET* rowset = (PG_ROWSET*)_clip_fetch_c_item( mp,_clip_parni(mp,1),_C_ITEM_TYPE_SQL); long time; long date = _clip_pardtj(mp,2,&time); int totext = _clip_parl(mp,3); if(!rowset){ _clip_trap_err(mp,0,0,0,subsys,ER_NOROWSET,er_norowset); return 1; } if((!totext)&&rowset->binary){ long l = date - _clip_jdate(1,1,2000); double d = l*(24*60*60) + time/1000; _clip_retcn(mp,(char*)&d,8); } else { char str[26]; int y,m,d,w,h,mm,s,t,q; _clip_cdate(date,&d,&m,&y,&w); h = time/(60*60*1000); q = time%(60*60*1000); mm = q/(60*1000); q %= 60*1000; s = q/(1000); t = q%1000; snprintf(str,sizeof(str),"%04d-%02d-%02d %02d:%02d:%02d.%02d+00",y,m,d,h,mm,s,t); _clip_retc(mp,str); } return 0; }
int clip_ODBC_OUT_TIMESTAMP(ClipMachine* mp){ long time; long julian = _clip_pardtj(mp,1,&time); short int s[6] = {0,0,0,0,0,0}; int yy,mm,dd,ww; long t; if(_clip_parinfo(mp,1) == DATE_t){ if(julian){ _clip_cdate(julian,&dd,&mm,&yy,&ww); s[0] = yy; s[1] = mm; s[2] = dd; } s[3] = time / (60*60*1000); t = time % (60*60*1000); s[4] = t / (60*1000); s[5] = (t % (60*1000)) / 1000; } _clip_retcn(mp,(char*)s,12); return 0; }