FACT++  1.0
logtime.cc
Go to the documentation of this file.
1 #include "MessageDim.h"
2 
3 #include "tools.h"
4 #include "Time.h"
5 
6 #include <iostream>
7 
8 int main(int, const char **)
9 {
10  // We could use putenv to make the Configure class change the value...
11  setenv("DIM_DNS_NODE", "localhost", 0);
12 
13  // Start a DimServer called TIME
14  DimServer::start("TIME");
15 
16 
17 
18  // Some info on the console
19  std::cout << "Offering TIME/MESSAGE...\n" << std::endl;
20 
21  // Setup a DimService called TIME/MESSAGE
22  MessageDimTX msg("TIME");
23  while (1)
24  {
25  // Send current time
26  msg.Message(Time().GetAsStr());
27 
28  // wait approximately one second
29  usleep(1000000);
30 
31  //std::cout << DimServer::getClientName() << std::endl;
32  //std::cout << DimServer::getClientId() << std::endl;
33  //std::cout << DimServer::getDnsPort() << std::endl;
34  std::cout << "con: " << dis_get_conn_id() << std::endl;
35 
37 
38  while (*ids)
39  {
40  std::cout << *ids << std::endl;
41  ids++;
42  }
43  }
44 
45  return 0;
46 }
47 
48 // **************************************************************************
57 // **************************************************************************
int ids[10]
Adds some functionality to boost::posix_time::ptime for our needs.
Definition: Time.h:30
int main(int, const char **)
Definition: logtime.cc:8
int dis_get_conn_id()
Definition: dis.c:2795
Based on MessageImp, redirects log-output to a Dim service MESSAGE.
Definition: MessageDim.h:10
static void start()
Definition: discpp.cxx:512
int Message(const std::string &str)
Definition: MessageImp.h:46
static char ** getClientServices()
Definition: discpp.cxx:601