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

Definition at line 1956 of file dis.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().

1957 {
1958  register SERVICE *servp;
1959  char str[128];
1960 #ifdef WIN32
1961  struct timeb timebuf;
1962 #else
1963  struct timeval tv;
1964  struct timezone *tz;
1965 #endif
1966 
1967  DISABLE_AST
1968  if(!serv_id)
1969  {
1970  sprintf(str,"Set Timestamp - Invalid service id");
1971  error_handler(0, DIM_ERROR, DIMSVCINVAL, str, -1);
1972  ENABLE_AST
1973  return(0);
1974  }
1975  servp = (SERVICE *)id_get_ptr(serv_id, SRC_DIS);
1976  if(!servp)
1977  {
1978  ENABLE_AST
1979  return(0);
1980  }
1981  if(servp->id != (int)serv_id)
1982  {
1983  ENABLE_AST
1984  return(0);
1985  }
1986  if(secs == 0)
1987  {
1988 #ifdef WIN32
1989  ftime(&timebuf);
1990  servp->user_secs = (int)timebuf.time;
1991  servp->user_millisecs = timebuf.millitm;
1992 #else
1993  tz = 0;
1994  gettimeofday(&tv, tz);
1995  servp->user_secs = (int)tv.tv_sec;
1996  servp->user_millisecs = (int)tv.tv_usec / 1000;
1997 #endif
1998  }
1999  else
2000  {
2001  servp->user_secs = secs;
2002 /*
2003  servp->user_millisecs = (millisecs & 0xffff);
2004 */
2005  servp->user_millisecs = millisecs;
2006  }
2007  ENABLE_AST
2008  return(1);
2009 }
int user_millisecs
Definition: dis.c:84
static void error_handler(int conn_id, int severity, int errcode, char *reason, int exit)
Definition: dis.c:3199
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
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: