Revision: 57225
          http://sourceforge.net/p/brlcad/code/57225
Author:   tbrowder2
Date:     2013-08-28 17:22:51 +0000 (Wed, 28 Aug 2013)
Log Message:
-----------
change signature and intent of bu_utctime; eliminate need for time.h in bu.h; 
change some attr struct vars to integral instead of char*

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

Modified: brlcad/trunk/include/bu.h
===================================================================
--- brlcad/trunk/include/bu.h   2013-08-28 15:29:09 UTC (rev 57224)
+++ brlcad/trunk/include/bu.h   2013-08-28 17:22:51 UTC (rev 57225)
@@ -86,7 +86,6 @@
 
 #include <stdlib.h>
 #include <sys/types.h>
-#include <time.h>
 
 __BEGIN_DECLS
 
@@ -1905,14 +1904,16 @@
  * These strings may or may not be individually allocated, it depends
  * on usage.
  */
-/* FIXME: struct name should be changed to reflect more date, say, 
bu_attribute_data */
+/* FIXME: struct name should be changed to reflect more data, say, 
bu_attribute_data */
 struct bu_attribute_value_pair {
-    const char *name;      /**< attribute name          */
-    const char *value;      /**< attribute value         */
-    const char *created;    /**< attribute date created  */
-    const char *modified;   /**< attribute date modified */
-    const char *version;    /**< attribute version       */
-    const char *anamespace; /**< attribute anamespace    */
+    const char *name;      /**< attribute name           */
+    const char *value;      /**< attribute value          */
+    const char *anamespace; /**< attribute anamespace     */
+
+    /* integral variables */
+    int version;            /**< attribute version number */
+    int64_t created;        /**< attribute date created   */
+    int64_t modified;       /**< attribute date modified  */
 };
 
 
@@ -6196,13 +6197,13 @@
 /** @ingroup io */
 /** @{ */
 /**
- * Evaluate the current UTC time in ISO format as a string.
+ * Evaluate the time_t input as UTC time in ISO format.
  *
  * The UTC time is written into the user-provided bu_vls struct and is
  * also returned and guaranteed to be a non-null result, returning a
  * static "NULL" UTC time if an error is encountered.
  */
-BU_EXPORT void bu_utctime(struct bu_vls *utc_result);
+BU_EXPORT void bu_utctime(struct bu_vls *utc_result, const int64_t time_val);
 
 /** @} */
 

Modified: brlcad/trunk/src/libbu/date-time.c
===================================================================
--- brlcad/trunk/src/libbu/date-time.c  2013-08-28 15:29:09 UTC (rev 57224)
+++ brlcad/trunk/src/libbu/date-time.c  2013-08-28 17:22:51 UTC (rev 57225)
@@ -27,20 +27,20 @@
 
 
 void
-bu_utctime(struct bu_vls *vls_gmtime)
+bu_utctime(struct bu_vls *vls_gmtime, const int64_t time_val)
 {
     static const char *nulltime = "0000-00-00T00:00:00Z";
     struct tm loctime;
     struct tm* retval;
-    time_t curr_time;
+    time_t some_time;
 
     if (!vls_gmtime)
        return;
 
     BU_CK_VLS(vls_gmtime);
 
-    curr_time = time(0);
-    if (curr_time == (time_t)(-1)) {
+    some_time = (time_t)time_val;
+    if (some_time == (time_t)(-1)) {
        /* time error: but set something, an invalid "NULL" time. */
        bu_vls_sprintf(vls_gmtime, nulltime);
        return;
@@ -49,7 +49,7 @@
     memset(&loctime, 0, sizeof(loctime));
 
     bu_semaphore_acquire(BU_SEM_DATETIME);
-    retval = gmtime(&curr_time);
+    retval = gmtime(&some_time);
     if (retval)
        loctime = *retval; /* struct copy */
     bu_semaphore_release(BU_SEM_DATETIME);

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