예제 #1
0
int
clip_LASTDAYOM(ClipMachine * ClipMachineMemory)
{
   int dd, mm, yy, ww, mm1;

   struct tm *sysTime;

   long d;

   int numpar = _clip_parinfo(ClipMachineMemory, 0);

   _clip_pardc(ClipMachineMemory, 1, &yy, &mm, &dd, &ww);
   mm1 = _clip_parni(ClipMachineMemory, 1);
   if (numpar == 0 || mm1 != 0)
   {
      sysTime = _clip_sysdate();
      yy = sysTime->tm_year + 1900;
      mm = sysTime->tm_mon + 1;
      dd = sysTime->tm_mday;
      free(sysTime);
   }
   if (mm1 != 0)
      mm = mm1;
   d = _clip_jdate(1, mm + 1, yy);
   _clip_cdate(d, &dd, &mm1, &yy, &ww);
   while (mm != mm1)
   {
      d--;
      _clip_cdate(d, &dd, &mm1, &yy, &ww);
   }
   _clip_retndp(ClipMachineMemory, dd, 2, 0);
   return 0;
}
예제 #2
0
int clip_PG_OUT_TIMESTAMP(ClipMachine* mp){
	PG_ROWSET* rowset = (PG_ROWSET*)_clip_fetch_c_item(
		mp,_clip_parni(mp,1),_C_ITEM_TYPE_SQL);
	int totext = _clip_parl(mp,3);
	struct tm time;
	time_t bindate;
	char* date;
	int len;

	if(!rowset){
		_clip_trap_err(mp,0,0,0,subsys,ER_NOROWSET,er_norowset);
		return 1;
	}
	if((!totext)&&rowset->binary){
		
		memset(&time,0,sizeof(time));
		_clip_pardc(mp,2,&time.tm_year,&time.tm_mon,&time.tm_mday,&time.tm_wday);
		time.tm_year -= 1900;
		time.tm_mon--;

		bindate = mktime(&time);
		_clip_retcn(mp,(char*)(&bindate),4);
	} else {
		date = _clip_parcl(mp,2,&len);
	        _clip_retc(mp,date);

//		char str[25];
//		_pg_out_date(mp,str,rowset->conn->datestyle,rowset->conn->textdate,_clip_pardj(mp,2));
//		_clip_retc(mp,str);
	}
	return 0;
}
예제 #3
0
int
clip_DAY(ClipMachine * ClipMachineMemory)
{
   int dd, mm, yy, ww;

   if (_clip_pardj(ClipMachineMemory, 1) == 0)
   {
      _clip_retndp(ClipMachineMemory, 0, 3, 0);
      return 0;
   }

   _clip_pardc(ClipMachineMemory, 1, &yy, &mm, &dd, &ww);
   _clip_retndp(ClipMachineMemory, dd, 3, 0);
   return 0;
}
예제 #4
0
int
clip_EOY(ClipMachine * ClipMachineMemory)
{
   int dd, mm, yy, ww;

   struct tm *sysTime;

   int numpar = _clip_parinfo(ClipMachineMemory, 0);

   _clip_pardc(ClipMachineMemory, 1, &yy, &mm, &dd, &ww);
   if (numpar == 0)
   {
      sysTime = _clip_sysdate();
      yy = sysTime->tm_year + 1900;
      mm = sysTime->tm_mon + 1;
      dd = sysTime->tm_mday;
      free(sysTime);
   }
   _clip_retdc(ClipMachineMemory, yy, 12, 31);
   return 0;
}