You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@geode.apache.org by "ASF GitHub Bot (Jira)" <ji...@apache.org> on 2021/05/02 16:22:00 UTC

[jira] [Commented] (GEODE-9214) Remove ACE time library references

    [ https://issues.apache.org/jira/browse/GEODE-9214?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17338069#comment-17338069 ] 

ASF GitHub Bot commented on GEODE-9214:
---------------------------------------

gaussianrecurrence commented on a change in pull request #797:
URL: https://github.com/apache/geode-native/pull/797#discussion_r624719632



##########
File path: tests/cpp/fwklib/FwkLog.cpp
##########
@@ -54,32 +55,24 @@ const char* dirAndFile(const char* str) {
 }
 
 void plog(const char* l, const char* s, const char* filename, int32_t lineno) {
-  // ACE_TCHAR tstamp[64];
-  // ACE::timestamp( tstamp, 64, 1 );
-  // tstamp is like "Tue May 17 2005 12:54:22.546780"
-  // for our purpose we just want "12:54:22.546780"
-  char buf[256] = {0};
-  const size_t MINBUFSIZE = 128;
-  ACE_Time_Value clock = ACE_OS::gettimeofday();
-  time_t secs = clock.sec();
-  struct tm* tm_val = ACE_OS::localtime(&secs);
-  char* pbuf = buf;
-  pbuf += ACE_OS::strftime(pbuf, MINBUFSIZE, "%Y/%m/%d %H:%M:%S", tm_val);
-  pbuf += ACE_OS::snprintf(pbuf, 15, ".%06" PRId64 " ",
-                           static_cast<int64_t>(clock.usec()));
-  ACE_OS::strftime(pbuf, MINBUFSIZE, "%Z ", tm_val);
-  static bool needInit = true;
-  if (needInit) {
-    ACE_OS::uname(&u);
-    needInit = false;
-  }
+  using std::chrono::duration_cast;
+  using std::chrono::microseconds;
+  using std::chrono::system_clock;
 
-  const char* fil = dirAndFile(filename);
+  auto now = system_clock::now();
+  auto in_time_t = system_clock::to_time_t(now);
+  auto localtime = std::localtime(&in_time_t);
+  auto usec =
+      duration_cast<microseconds>(now.time_since_epoch()).count() % 1000;
 
-  fprintf(stdout, "[%s %s %s:P%d:T%" PRIu64 "]::%s::%d  %s  %s\n", buf,
-          u.sysname, u.nodename, ACE_OS::getpid(),
-          hacks::aceThreadId(ACE_OS::thr_self()), fil, lineno, l, s);
-  fflush(stdout);
+  const char* fil = dirAndFile(filename);
+  std::cout << '[' << std::put_time(localtime, "%Y/%m/%d %H:%M:%S") << '.'
+            << std::setfill('0') << std::setw(6) << usec << std::setw(0)
+            << std::put_time(localtime, " %Z ") << boost::asio::ip::host_name()

Review comment:
       I think I'll go for boost log. Thanks for pointing it out.




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


> Remove ACE time library references
> ----------------------------------
>
>                 Key: GEODE-9214
>                 URL: https://issues.apache.org/jira/browse/GEODE-9214
>             Project: Geode
>          Issue Type: Improvement
>          Components: native client
>            Reporter: Mario Salazar de Torres
>            Assignee: Mario Salazar de Torres
>            Priority: Major
>              Labels: obliterate-ace, pull-request-available
>
> *AS A* geode-native contributor
> *I WANT TO* remove all references to ACE time library
> *SO THAT* we can advance in the effort to completly remove ACE library from the native client



--
This message was sent by Atlassian Jira
(v8.3.4#803005)