Index: trunk/psLib/src/xml/psXML.c
===================================================================
--- trunk/psLib/src/xml/psXML.c	(revision 4981)
+++ trunk/psLib/src/xml/psXML.c	(revision 5000)
@@ -10,6 +10,6 @@
 *  @author David Robbins, MHPCC
 *
-*  @version $Revision: 1.38 $ $Name: not supported by cvs2svn $
-*  @date $Date: 2005-08-27 01:33:41 $
+*  @version $Revision: 1.39 $ $Name: not supported by cvs2svn $
+*  @date $Date: 2005-09-12 21:36:54 $
 *
 *  Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii
@@ -54,4 +54,5 @@
     char content[MAXSTR];
     char vec[MAXVEC];
+    char timeVal[MAXSTR];
     int i;
     psMetadataIterator *iter = psMetadataIteratorAlloc(*(psMetadata**)&md, PS_LIST_HEAD, NULL);
@@ -73,4 +74,6 @@
         if ( type == 65547)
             type = PS_DATA_METADATA;
+        if ( type == 65549)
+            type = PS_DATA_TIME;
         switch (type) {
         case PS_DATA_BOOL:
@@ -123,4 +126,30 @@
             new_node = xmlAddSibling(cur_node, new_root);
             psFree(newDoc);
+            break;
+        case PS_DATA_TIME:
+            cur_node = xmlNewChild(root, NULL, (const xmlChar*)"time", (const xmlChar*)"\n");
+            prop = xmlNewProp(cur_node, (const xmlChar*)"name", (const xmlChar*)item->name);
+            if ( ((psTime*)(item->data.V))->type == PS_TIME_UTC )
+                prop = xmlNewProp(cur_node, (const xmlChar*)"psType", (const xmlChar*)"PS_TIME_UTC");
+            else if ( ((psTime*)(item->data.V))->type == PS_TIME_TAI )
+                prop = xmlNewProp(cur_node, (const xmlChar*)"psType", (const xmlChar*)"PS_TIME_TAI");
+            else if ( ((psTime*)(item->data.V))->type == PS_TIME_UT1 )
+                prop = xmlNewProp(cur_node, (const xmlChar*)"psType", (const xmlChar*)"PS_TIME_UT1");
+            else if ( ((psTime*)(item->data.V))->type == PS_TIME_TT )
+                prop = xmlNewProp(cur_node, (const xmlChar*)"psType", (const xmlChar*)"PS_TIME_TT");
+            else {
+                psError(PS_ERR_BAD_PARAMETER_VALUE, true,
+                        PS_ERRORTEXT_psXML_INVALID_CONTENT);
+                return NULL;
+            }
+            snprintf(content, MAXSTR, "%ld, ", ((psTime*)(item->data.V))->sec);
+            strncpy(timeVal, content, MAXSTR);
+            snprintf(content, MAXSTR, "%u, ", ((psTime*)(item->data.V))->nsec);
+            strncat(timeVal, content, MAXSTR);
+            if ( ((psTime*)(item->data.V))->leapsecond )
+                strncat(timeVal, "T", MAXSTR);
+            else
+                strncat(timeVal, "F", MAXSTR);
+            prop = xmlNewProp(cur_node, (const xmlChar*)"value", (const xmlChar*)timeVal);
             break;
         case PS_DATA_VECTOR:
@@ -140,5 +169,4 @@
                     strncat(vec, content, MAXSTR);
                 }
-
                 break;
             case PS_DATA_F32:
@@ -266,4 +294,38 @@
 }
 
+static void storeTime(psTime *out, char *in)
+{
+    char *endp;
+    long sec = 0;
+    unsigned int nsec = 0;
+
+    sec = strtol(in, &endp, 10);
+    out->sec = sec;
+    if ( !strncmp(endp, ",", 1) )
+        endp++;
+    else
+        psError(PS_ERR_BAD_PARAMETER_VALUE, true,
+                PS_ERRORTEXT_psXML_INVALID_CONTENT);
+    in = endp;
+    nsec = (unsigned int)strtol(in, &endp, 10);
+    out->nsec = nsec;
+    if ( !strncmp(endp, ",", 1) )
+        endp++;
+    else
+        psError(PS_ERR_BAD_PARAMETER_VALUE, true,
+                PS_ERRORTEXT_psXML_INVALID_CONTENT);
+    in = endp;
+    if ( !strncmp(in, "false", 10) || !strncmp(in, "f", 10) ||
+            !strncmp(in, "FALSE", 10) || !strncmp(in, " F", 10) )
+        out->leapsecond = false;
+    else if ( !strncmp(in, "true", 10) || !strncmp(in, "t", 10) ||
+              !strncmp(in, "TRUE", 10) || !strncmp(in, "T", 10) )
+        out->leapsecond = true;
+    else {
+        psError(PS_ERR_BAD_PARAMETER_VALUE, true,
+                PS_ERRORTEXT_psXML_INVALID_CONTENT);
+    }
+}
+
 //Check the xml item for errors.  Returns the data type or PS_DATA_UNKNOWN for errors.//
 static psDataType chkType(xmlNode *node)
@@ -309,4 +371,14 @@
         }
     }
+    if(!strncmp((const char*)node->name, "time", MAXSTR) || !strncmp((const char*)node->name, "TIME", MAXSTR) ) {
+        if (node->properties != NULL && node->properties->name
+                && node->properties->next != NULL && node->properties->next->name != NULL) {
+            return(PS_DATA_TIME);
+        } else {
+            psError(PS_ERR_BAD_PARAMETER_VALUE, true,
+                    PS_ERRORTEXT_psXML_INVALID_CONTENT);
+            return(PS_DATA_UNKNOWN);
+        }
+    }
     return(PS_DATA_UNKNOWN);
 }
@@ -385,7 +457,34 @@
                     psFree(vec);
                     break;
+                case PS_DATA_TIME:
+                    strncpy(name, (const char*)cur_node->properties->children->content, MAXSTR);
+                    strncpy(content,
+                            (const char*)cur_node->properties->next->next->children->content, MAXSTR);
+                    psTimeType timeType;
+                    char type[MAXSTR];
+                    strncpy(type, (const char*)cur_node->properties->next->children->content, MAXSTR);
+                    if ( !strncmp(type, "PS_TIME_UTC", MAXSTR) )
+                        timeType = PS_TIME_UTC;
+                    else if ( !strncmp(type, "PS_TIME_TAI", MAXSTR) )
+                        timeType = PS_TIME_TAI;
+                    else if ( !strncmp(type, "PS_TIME_UT1", MAXSTR) )
+                        timeType = PS_TIME_UT1;
+                    else if ( !strncmp(type, "PS_TIME_TT", MAXSTR) )
+                        timeType = PS_TIME_TT;
+                    else {
+                        psError(PS_ERR_BAD_PARAMETER_VALUE, true,
+                                PS_ERRORTEXT_psXML_INVALID_CONTENT);
+                        psFree(meta);
+                        return NULL;
+                    }
+
+                    psTime *time;
+                    time = psTimeAlloc(timeType);
+                    storeTime(time, content);
+                    psMetadataAddTime(meta, PS_LIST_TAIL, name, 0, "", time);
+                    psFree(time);
+                    break;
                 case PS_DATA_METADATA:
                     strncpy(name, (const char*)cur_node->properties->children->content, MAXSTR);
-                    //                        psMetadata *temp = psMetadataAlloc();
                     psMetadata *temp = NULL;
                     temp = xml2metadata(cur_node->children, nodeNum);
Index: trunk/psLib/src/xml/psXML.h
===================================================================
--- trunk/psLib/src/xml/psXML.h	(revision 4981)
+++ trunk/psLib/src/xml/psXML.h	(revision 5000)
@@ -10,6 +10,6 @@
  *  @author David Robbins, MHPCC
  *
- *  @version $Revision: 1.18 $ $Name: not supported by cvs2svn $
- *  @date $Date: 2005-08-18 21:44:40 $
+ *  @version $Revision: 1.19 $ $Name: not supported by cvs2svn $
+ *  @date $Date: 2005-09-12 21:36:54 $
  *
  *  Copyright 2005 Maui High Performance Computing Center, University of Hawaii
@@ -31,4 +31,5 @@
 #include "psString.h"
 #include "psConstants.h"
+#include "psTime.h"
 #include "psErrorText.h"
 
