Revision: 57196
          http://sourceforge.net/p/brlcad/code/57196
Author:   brlcad
Date:     2013-08-28 02:52:41 +0000 (Wed, 28 Aug 2013)
Log Message:
-----------
call gmtime() instead of gmtime_r() for c89+ compliance and greater 
portability.  makes things really simple for windows too (they provide gmtime())

Modified Paths:
--------------
    brlcad/trunk/src/libbu/date-time.c

Modified: brlcad/trunk/src/libbu/date-time.c
===================================================================
--- brlcad/trunk/src/libbu/date-time.c  2013-08-28 02:52:05 UTC (rev 57195)
+++ brlcad/trunk/src/libbu/date-time.c  2013-08-28 02:52:41 UTC (rev 57196)
@@ -34,25 +34,24 @@
 {
     struct tm loctime;
     struct tm* retval;
-    time_t curr_time = time(0);
+    time_t curr_time;
+
+    if (!vls_gmtime)
+       return;
+
     BU_CK_VLS(vls_gmtime);
 
+    curr_time = time(0);
     if (curr_time == (time_t)(-1)) {
        /* time error: but set something */
        bu_vls_sprintf(vls_gmtime, "TIME_ERROR");
        return;
     }
 
-#ifdef HAVE_GMTIME_S
-    retval = gmtime_s(&loctime, &curr_time);
-#else
-    retval = gmtime_r(&curr_time, &loctime);
-#endif
-    if (retval != &loctime) {
-       /* time error: but set something */
-       bu_vls_sprintf(vls_gmtime, "TIME_ERROR");
-       return;
-    }
+    bu_semaphore_acquire(BU_SEM_DATETIME);
+    retval = gmtime(&curr_time);
+    loctime = *retval; /* struct copy */
+    bu_semaphore_release(BU_SEM_DATETIME);
 
     /* put the UTC time in the desired ISO format: "yyyy-mm-ddThh:mm:ssZ" */
     bu_vls_sprintf(vls_gmtime, "%04d-%02d-%02dT%02d:%02d:%02dZ",

This was sent by the SourceForge.net collaborative development platform, the 
world's largest Open Source development site.


------------------------------------------------------------------------------
Learn the latest--Visual Studio 2012, SharePoint 2013, SQL 2012, more!
Discover the easy way to master current and previous Microsoft technologies
and advance your career. Get an incredible 1,500+ hours of step-by-step
tutorial videos with LearnDevNow. Subscribe today and save!
http://pubads.g.doubleclick.net/gampad/clk?id=58040911&iu=/4140/ostg.clktrk
_______________________________________________
BRL-CAD Source Commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/brlcad-commits

Reply via email to