FACT++  1.0
int dis_set_timestamp ( unsigned  serv_id,
int  secs,
int  millisecs 
)

Definition at line 1776 of file dis_old.c.

References DIM_ERROR, DIMSVCINVAL, error_handler(), serv::id, id_get_ptr(), serv_id, sprintf(), SRC_DIS, str, serv::user_millisecs, and serv::user_secs.

Referenced by dis_hash_print(), and execute_command().

1777 {
1778  register SERVICE *servp;
1779  char str[128];
1780 #ifdef WIN32
1781  struct timeb timebuf;
1782 #else
1783  struct timeval tv;
1784  struct timezone *tz;
1785 #endif
1786 
1787  DISABLE_AST
1788  if(!serv_id)
1789  {
1790  sprintf(str,"Set Timestamp - Invalid service id");
1792  ENABLE_AST
1793  return(0);
1794  }
1795  servp = (SERVICE *)id_get_ptr(serv_id, SRC_DIS);
1796  if(!servp)
1797  {
1798  ENABLE_AST
1799  return(0);
1800  }
1801  if(servp->id != (int)serv_id)
1802  {
1803  ENABLE_AST
1804  return(0);
1805  }
1806  if(secs == 0)
1807  {
1808 #ifdef WIN32
1809  ftime(&timebuf);
1810  servp->user_secs = (int)timebuf.time;
1811  servp->user_millisecs = timebuf.millitm;
1812 #else
1813  tz = 0;
1814  gettimeofday(&tv, tz);
1815  servp->user_secs = tv.tv_sec;
1816  servp->user_millisecs = tv.tv_usec / 1000;
1817 #endif
1818  }
1819  else
1820  {
1821  servp->user_secs = secs;
1822 /*
1823  servp->user_millisecs = (millisecs & 0xffff);
1824 */
1825  servp->user_millisecs = millisecs;
1826  }
1827  ENABLE_AST
1828  return(1);
1829 }
int user_millisecs
Definition: dis.c:84
char str[80]
Definition: test_client.c:7
void * id_get_ptr(int id, SRC_TYPES type)
Definition: conn_handler.c:184
Definition: dis.c:69
int user_secs
Definition: dis.c:83
#define DIMSVCINVAL
Definition: dim_common.h:290
int serv_id
Definition: demo_server.c:5
static void error_handler(int conn_id, int severity, int errcode, char *reason)
Definition: dis_old.c:2827
sprintf(name1,"NewService%d", i)
int id
Definition: dis.c:73

+ Here is the call graph for this function:

+ Here is the caller graph for this function: