You are viewing a plain text version of this content. The canonical link for it is here.
Posted to axis-cvs@ws.apache.org by da...@apache.org on 2004/01/01 07:46:02 UTC

cvs commit: ws-axis/c/src/common AxisTime.cpp

damitha     2003/12/31 22:46:02

  Modified:    c/src/common Tag: Release-2003_10_26-bugfixes_branch
                        AxisTime.cpp
  Log:
  
  
  Revision  Changes    Path
  No                   revision
  No                   revision
  1.11.2.1  +233 -226  ws-axis/c/src/common/AxisTime.cpp
  
  Index: AxisTime.cpp
  ===================================================================
  RCS file: /home/cvs/ws-axis/c/src/common/AxisTime.cpp,v
  retrieving revision 1.11
  retrieving revision 1.11.2.1
  diff -u -r1.11 -r1.11.2.1
  --- AxisTime.cpp	24 Oct 2003 12:14:59 -0000	1.11
  +++ AxisTime.cpp	1 Jan 2004 06:46:02 -0000	1.11.2.1
  @@ -63,6 +63,8 @@
   #include <axis/common/AxisTime.h>
   #include <axis/common/AxisUtils.h>
   
  +#define TIMEBUFFSIZE 80
  +
   AxisTime::AxisTime()
   {
   
  @@ -175,17 +177,17 @@
       switch(nType)
       {
           case XSD_DATETIME:
  -            strftime(buf1, 80, "%Y-%m-%dT%H:%M:%SZ", &tValue);
  +            strftime(buf1, TIMEBUFFSIZE, "%Y-%m-%dT%H:%M:%SZ", &tValue);
               strXSDDate = buf1;
               //AxisUtils::convert(strXSDDate, buf1);
               break;
           case XSD_DATE:
  -            strftime(buf1, 80, "%Y-%m-%dZ", &tValue);
  +            strftime(buf1, TIMEBUFFSIZE, "%Y-%m-%dZ", &tValue);
               strXSDDate = buf1;
               //AxisUtils::convert(strXSDDate, buf1);
               break;
           case XSD_TIME:
  -            strftime(buf1, 80, "%H:%M:%SZ", &tValue);
  +            strftime(buf1, TIMEBUFFSIZE, "T%H:%M:%SZ", &tValue);
               strXSDDate = buf1;
               //AxisUtils::convert(strXSDDate, buf1);
               break;
  @@ -200,11 +202,18 @@
   * This function deserialize the xml datetime type into a c type
   * tm struct. The struct tm created will contain the UTC time
   */
  -void AxisTime::mkCTime()
  +int AxisTime::mkCTime()
   {
   //    AxisChar* endptr;
  +    AxisChar* cUtc;
  +    AxisChar* cTemp;
  +    AxisChar* cTemp2;
  +    AxisChar* cTemp3;
  +    int intLen = 0;
  +    int intHours = 0;
  +    int intMins = 0;
  +    int intSecs = 0;
       unsigned int intPos, intPos1, intPos2, intPos3, intPos4, intPos5, intPos6;
  -    AxisChar buff[4] = {0};
       time_t now;
       struct tm result1, result2;
   	struct tm* pTm;
  @@ -214,6 +223,8 @@
   	pTm = localtime(&now);
   	memcpy(&result2, pTm, sizeof(tm));
       time_t d = mktime(&result1) - mktime(&result2);
  +    if(d == -1)
  +        return AXIS_FAIL;
   
       switch(m_Type)
       {
  @@ -267,95 +278,75 @@
                   CCYY(-)MM(-)DDThh:mm:ss.ss...Z OR
                   CCYY(-)MM(-)DDThh:mm:ss.ss...+/-<UTC TIME DIFFERENCE>
               */
  -            strYears = m_sValue.substr(0,4);
  -            m_intYears = atoi(strYears.c_str()) - 1900;
  -            //m_intYears = wcstol(strYears.c_str(), &endptr, 10) - 1900;
  -            //sprintf((char*)buff,"%d", m_intYears);
  -            AxisSprintf(buff, 4, "%d", m_intYears);
  -            strYears = buff;
  -            intPos = m_sValue.find_first_of("-");
  -            /* date is of the format CCYY-MM-DD */
  -            if(intPos != std::string::npos && intPos<=7)
  -            {
  -                strMonths = m_sValue.substr(5,2);
  -                strDays = m_sValue.substr(8,2);
  -                strHours = m_sValue.substr(11,2);
  -                strMins = m_sValue.substr(14,2);
  -                /*Decimal fraction of the second is omitted*/
  -                strSecs = m_sValue.substr(17,2);
  -                strZone = m_sValue.substr(19,m_sValue.length()-19);
  -            }
  -            /* date is of the format CCYYMMDD */
  -            else if((intPos == std::string::npos) || (intPos != std::string::npos && intPos > 7))
  -            {
  -                strMonths = m_sValue.substr(4,2);
  -                strMonths = m_sValue.substr(6,2);
  -                strHours = m_sValue.substr(9,2);
  -                strMins = m_sValue.substr(12,2);
  -                /*Decimal fraction of the second is omitted*/
  -                strSecs = m_sValue.substr(15,2);
  -                strZone = m_sValue.substr(17,m_sValue.length()-17);
  -            }
  +            if(sscanf(m_sValue.c_str(), "%d-%d-%dT%d:%d:%d",
  +                &m_TM.tm_year,
  +                &m_TM.tm_mon,
  +                &m_TM.tm_mday,
  +                &m_TM.tm_hour,
  +                &m_TM.tm_min,
  +                &m_TM.tm_sec) != 6) return AXIS_FAIL;/*invalid data format*/
  +
   
  -            m_TM.tm_year = atoi(strYears.c_str());
  -            //m_TM.tm_year = wcstol(strYears.c_str(), &endptr, 10);
  -            m_TM.tm_mon = atoi(strMonths.c_str());
  -            //m_TM.tm_mon = wcstol(strMonths.c_str(), &endptr, 10);
  -            m_TM.tm_mday = atoi(strDays.c_str());
  -            //m_TM.tm_mday = wcstol(strDays.c_str(), &endptr, 10);
  -            m_TM.tm_hour = atoi(strHours.c_str());
  -            //m_TM.tm_hour = wcstol(strHours.c_str(), &endptr, 10);
  -            m_TM.tm_min = atoi(strMins.c_str());
  -            //m_TM.tm_min = wcstol(strMins.c_str(), &endptr, 10);
  -            m_TM.tm_sec = atoi(strSecs.c_str());
  -            //m_TM.tm_sec = wcstol(strSecs.c_str(), &endptr, 10);
  +
  +            m_TM.tm_year -= 1900;
  +            m_TM.tm_mon--;
  +            m_TM.tm_isdst = -1;
  +            m_TM.tm_zone = NULL;
  +            m_TM.tm_gmtoff = -1;
  +
  +            cTemp2 = strpbrk(m_sValue.c_str(), "T");
  +            cTemp3 = strrchr(cTemp2, ':');
  +            cTemp3[0] = '\0';
  +            intLen = strlen(cTemp2);
  +            cTemp3[0] = ':';
   
               /*if the timezone is represented adding 'Z' at the end*/
  -            if(strZone.substr(0,1) == "Z")
  +            if((cTemp = strpbrk(m_sValue.c_str(), "Z")) != NULL)
               {
  -                time_t timeInSecs = mktime(&m_TM);
  -				pTm = localtime(&timeInSecs);
  -				memcpy(&m_TMUTC, pTm, sizeof(tm));
  +                time_t temp = mktime(&m_TM);
  +                if(temp == -1)
  +                    return AXIS_FAIL;
  +                pTm = localtime(&temp);
  +                memcpy(&m_TMUTC, pTm, sizeof(tm));
               }
               /*if the timezone is represented using +/-hh:mm format*/
  -            else if(strZone.substr(0,1) == "+" ||strZone.substr(0,1) == "-")
  -            {
  -                time_t timeInSecs = mktime(&m_TM);
  -				pTm = localtime(&timeInSecs);
  -				memcpy(&m_TMUTC, pTm, sizeof(tm));
  -                m_intHours = atoi(strZone.substr(1,2).c_str());
  -                //m_intHours = wcstol(strZone.substr(1,2).c_str(), &endptr, 10);
  -                m_intMins = atoi(strZone.substr(3,2).c_str());
  -                //m_intMins = wcstol(strZone.substr(3,2).c_str(), &endptr, 10);
  -                m_intSecs = m_intHours * 60 * 60 + m_intMins * 60;
  -                if(strZone.substr(0,1) == "+")
  -                {
  -                    timeInSecs += m_intSecs;
  -					pTm = localtime(&timeInSecs);
  -					memcpy(&m_TM, pTm, sizeof(tm));
  -                    time_t t = mktime(&m_TM);
  -                    t = abs(t - d);
  -					pTm = gmtime(&t);
  -					memcpy(&m_TMUTC, pTm, sizeof(tm));
  -                }
  -                else if(strZone.substr(0,1) == "-")
  -                {
   
  -                    timeInSecs -= m_intSecs;
  -					pTm = localtime(&timeInSecs);
  -					memcpy(&m_TM, pTm, sizeof(tm));
  -
  -                    time_t t = mktime(&m_TM);
  -                    t = abs(t - d);
  -					pTm = gmtime(&t);
  -					memcpy(&m_TMUTC, pTm, sizeof(tm));
  -                }
  -            }
  +           else if(intLen > (sizeof(char) * 6))
  +           {
  +               cUtc = strpbrk(cTemp2, "+");
  +               if(cUtc == NULL)
  +                   cUtc = strpbrk(cTemp2, "-");
  +               time_t timeInSecs = mktime(&m_TM);
  +               if(timeInSecs == -1)
  +                   return AXIS_FAIL;
  +               //pTm = localtime(&timeInSecs);
  +               if(sscanf(cUtc + 1, "%d:%d", &intHours, &intMins) != 2)
  +               return AXIS_FAIL;
  +               intSecs = intHours * 60 * 60 + intMins * 60;
  +               if((cTemp = strpbrk((cUtc), "+")) != NULL )
  +               {
  +                   timeInSecs += intSecs;    
  +               }
  +               else
  +               {
  +                   timeInSecs -= intSecs;               
  +               }
  +               pTm = localtime(&timeInSecs);
  +               memcpy(&m_TM, pTm, sizeof(tm));
  +               time_t t = mktime(&m_TM);
  +               if(t == -1)
  +                   return AXIS_FAIL;
  +               t = abs(t - d);
  +               pTm = gmtime(&t);
  +               memcpy(&m_TMUTC, pTm, sizeof(tm));
  +           }
               /*if the zone is not represented in the date*/
               else
               {
                   /*else it is assumed that the sent time is localtime*/
                   time_t timeInSecs = mktime(&m_TM);
  +                if(timeInSecs == -1)
  +                    return AXIS_FAIL;
   				pTm = gmtime(&timeInSecs);
   				memcpy(&m_TMUTC, pTm, sizeof(tm));
               }
  @@ -368,79 +359,68 @@
                   CCYY(-)MM(-)DDZ OR
                   CCYY(-)MM(-)DD+/-<UTC TIME DIFFERENCE>
               */
  -            strYears = m_sValue.substr(0,4);
  -            m_intYears = atoi(strYears.c_str()) - 1900;
  -            //m_intYears = wcstol(strYears.c_str(), &endptr, 10) - 1900;
  -            //sprintf((char*)buff,"%d", m_intYears);
  -            AxisSprintf(buff, 4, "%d", m_intYears);
  -            strYears = buff;
  -            intPos = m_sValue.find_first_of("-");
  -            /* date is of the format CCYY-MM-DD */
  -            if(intPos != std::string::npos && intPos <= 7)
  -            {
  -                strMonths = m_sValue.substr(5,2);
  -                strDays = m_sValue.substr(8,2);
  -                strZone = m_sValue.substr(10,m_sValue.length() - 10);
  -            }
  -            /* date is of the format CCYYMMDD */
  -            else if((intPos == std::string::npos) || (intPos != std::string::npos && intPos > 7))
  -            {
  -                strMonths = m_sValue.substr(4,2);
  -                strMonths = m_sValue.substr(6,2);
  -                strZone = m_sValue.substr(8,m_sValue.length() - 8);
  -            }
  -
  -            m_TM.tm_year = atoi(strYears.c_str());
  -            //m_TM.tm_year= wcstol(strYears.c_str(), &endptr, 10);
  -            m_TM.tm_mon = atoi(strMonths.c_str());
  -            //m_TM.tm_mon = wcstol(strMonths.c_str(), &endptr, 10);
  -            m_TM.tm_mday = atoi(strDays.c_str());
  -            //m_TM.tm_mday = wcstol(strDays.c_str(), &endptr, 10);
  +            if(sscanf(m_sValue.c_str(), "%d-%d-%d",
  +                &m_TM.tm_year,
  +                &m_TM.tm_mon,
  +                &m_TM.tm_mday
  +                ) != 3) return AXIS_FAIL;/*invalid data format*/
  +
  +            m_TM.tm_year -= 1900;
  +            m_TM.tm_mon--;
  +            m_TM.tm_hour = 0;
  +            m_TM.tm_min = 0;
  +            m_TM.tm_sec = 0;
  +            m_TM.tm_isdst = -1;
  +            m_TM.tm_zone = NULL;
  +            m_TM.tm_gmtoff = -1;
  +            
  +            cTemp3 = strpbrk(m_sValue.c_str(), ":");
   
               /*if the timezone is represented adding 'Z' at the end*/
  -            if(strZone.substr(0,1) == "Z")
  +            if((cTemp = strpbrk(m_sValue.c_str(), "Z")) != NULL)
               {
                   time_t timeInSecs = mktime(&m_TM);
  +                if(timeInSecs == -1)
  +                    return AXIS_FAIL;
   				pTm = localtime(&timeInSecs);
   				memcpy(&m_TMUTC, pTm, sizeof(tm));
               }
  -            /*if the timezone is represented using +/-hh:mm format*/
  -            else if(strZone.substr(0,1) == "+" ||strZone.substr(0,1) == "-")
  +            else if(cTemp3 != NULL )
  +
               {
  +                cUtc = strrchr(m_sValue.c_str(), '+');
  +                if(cUtc == NULL)
  +                    cUtc = strrchr(m_sValue.c_str(), '-');
                   time_t timeInSecs = mktime(&m_TM);
  -				pTm = localtime(&timeInSecs);
  -				memcpy(&m_TMUTC, pTm, sizeof(tm));
  -                m_intHours = atoi(strZone.substr(1,2).c_str());
  -                //m_intHours = wcstol(strZone.substr(1,2).c_str(), &endptr, 10);
  -                m_intMins = atoi(strZone.substr(3,2).c_str());
  -                //m_intMins = wcstol(strZone.substr(3,2).c_str(), &endptr, 10);
  -                m_intSecs = m_intHours * 60 * 60 + m_intMins * 60;
  -                if(strZone.substr(0,1) == "+")
  +                if(timeInSecs == -1)
  +                    return AXIS_FAIL;
  +                if(sscanf(cUtc + 1, "%d:%d", &intHours, &intMins) != 2)
  +                return AXIS_FAIL;
  +                intSecs = intHours * 60 * 60 + intMins * 60;
  +                if((cTemp = strpbrk((cUtc), "+")) != NULL )
                   {
  -                    timeInSecs += m_intSecs;
  -					pTm = localtime(&timeInSecs);
  -					memcpy(&m_TM, pTm, sizeof(tm));
  -                    time_t t = mktime(&m_TM);
  -                    t = abs(t - d);
  -					pTm = gmtime(&t);
  -					memcpy(&m_TMUTC, pTm, sizeof(tm));
  +                    timeInSecs += intSecs;
                   }
  -                else if(strZone.substr(0,1) == "-")
  +                else
                   {
  -                    timeInSecs -= m_intSecs;
  -					pTm = localtime(&timeInSecs);
  -					memcpy(&m_TM, pTm, sizeof(tm));
  -                    time_t t = mktime(&m_TM);
  -                    t = abs(t - d);
  -					pTm = gmtime(&t);
  -					memcpy(&m_TMUTC, pTm, sizeof(tm));
  +                    timeInSecs -= intSecs;
                   }
  +                pTm = localtime(&timeInSecs);
  +				memcpy(&m_TM, pTm, sizeof(tm));
  +                time_t t = mktime(&m_TM);
  +                if(t == -1)
  +                    return AXIS_FAIL;
  +                t = abs(t - d);
  +				pTm = gmtime(&t);
  +				memcpy(&m_TMUTC, pTm, sizeof(tm));
               }
               /*if the zone is not represented in the date*/
               else
               {
                   /*else it is assumed that the sent time is localtime*/
                   time_t timeInSecs = mktime(&m_TM);
  +                if(timeInSecs == -1)
  +                    return AXIS_FAIL;
   				pTm = gmtime(&timeInSecs);
   				memcpy(&m_TMUTC, pTm, sizeof(tm));
               }
  @@ -453,68 +433,81 @@
                   hh:mm:ss.ss...Z OR
                   hh:mm:ss.ss...+/-<UTC TIME DIFFERENCE>
               */
  -            strHours = m_sValue.substr(0,2);
  -            strMins = m_sValue.substr(3,2);
  -            /*Decimal fraction of the second is omitted*/
  -            strSecs = m_sValue.substr(6,2);
  -            strZone = m_sValue.substr(8,m_sValue.length() - 8);
  -
  -            m_TM.tm_hour = atoi(strHours.c_str());
  -            //m_TM.tm_hour = wcstol(strHours.c_str(), &endptr, 10);
  -            m_TM.tm_min = atoi(strMins.c_str());
  -            //m_TM.tm_min = wcstol(strMins.c_str(), &endptr, 10);
  -            m_TM.tm_sec = atoi(strSecs.c_str());
  -            //m_TM.tm_sec = wcstol(strSecs.c_str(), &endptr, 10);
  +            if(sscanf(m_sValue.c_str(), "T%d:%d:%d",
  +                &m_TM.tm_hour,
  +                &m_TM.tm_min,
  +                &m_TM.tm_sec) != 3) return AXIS_FAIL;/*invalid data format*/
  +
  +            m_TM.tm_year = 70;
  +            m_TM.tm_mon = 0;
  +            m_TM.tm_mday = 0;
  +            m_TM.tm_isdst = -1;
  +            m_TM.tm_zone = NULL;
  +            m_TM.tm_gmtoff = -1;
  +            printf("m_sValue:%s\n", m_sValue.c_str());
  +
  +            cTemp2 = strpbrk(m_sValue.c_str(), "T");
  +            printf("cTemp2:%s\n", cTemp2);
  +            cTemp3 = strrchr(cTemp2, ':');
  +            printf("cTemp3:%s\n", cTemp3);
  +            cTemp3[0] = '\0';
  +            intLen = strlen(cTemp2);
  +            cTemp3[0] = ':';
   
               /*if the timezone is represented adding 'Z' at the end*/
  -            if(strZone.substr(0,1) == "Z")
  +            if((cTemp = strpbrk(m_sValue.c_str(), "Z")) != NULL)
               {
  -                time_t timeInSecs = mktime(&m_TM);
  -				pTm = localtime(&timeInSecs);
  -				memcpy(&m_TMUTC, pTm, sizeof(tm));
  +                time_t temp = mktime(&m_TM);
  +                if(temp == -1)
  +                    return AXIS_FAIL;
  +                pTm = localtime(&temp);
  +                memcpy(&m_TMUTC, pTm, sizeof(tm));
               }
               /*if the timezone is represented using +/-hh:mm format*/
  -            else if(strZone.substr(0,1) == "+" ||strZone.substr(0,1) == "-")
  -            {
  -                time_t timeInSecs = mktime(&m_TM);
  -				pTm = localtime(&timeInSecs);
  -				memcpy(&m_TMUTC, pTm, sizeof(tm));
  -                m_intHours = atoi(strZone.substr(1,2).c_str());
  -                //m_intHours = wcstol(strZone.substr(1,2).c_str(), &endptr, 10);
  -                m_intMins = atoi(strZone.substr(3,2).c_str());
  -                //m_intMins = wcstol(strZone.substr(3,2).c_str(), &endptr, 10);
  -                m_intSecs = m_intHours * 60 * 60 + m_intMins * 60;
  -                if(strZone.substr(0,1) == "+")
  -                {
  -                    timeInSecs += m_intSecs;
  -					pTm = localtime(&timeInSecs);
  -					memcpy(&m_TM, pTm, sizeof(tm));
  -                    time_t t = mktime(&m_TM);
  -                    t = abs(t - d);
  -					pTm = gmtime(&t);
  -					memcpy(&m_TMUTC, pTm, sizeof(tm));
  -                }
  -                else if(strZone.substr(0,1) == "-")
  -                {
  -                    timeInSecs -= m_intSecs;
  -					pTm = localtime(&timeInSecs);
  -					memcpy(&m_TM, pTm, sizeof(tm));
  -                    time_t t = mktime(&m_TM);
  -                    t = abs(t - d);
  -					pTm = gmtime(&t);
  -					memcpy(&m_TMUTC, pTm, sizeof(tm));
  -                }
  -            }
  +
  +           else if(intLen > (sizeof(char) * 6))
  +           {
  +               cUtc = strpbrk(cTemp2, "+");
  +               if(cUtc == NULL)
  +                   cUtc = strpbrk(cTemp2, "-");
  +               time_t timeInSecs = mktime(&m_TM);
  +               if(timeInSecs == -1)
  +                    return AXIS_FAIL;
  +               //pTm = localtime(&timeInSecs);
  +               if(sscanf(cUtc + 1, "%d:%d", &intHours, &intMins) != 2)
  +               return AXIS_FAIL;
  +               intSecs = intHours * 60 * 60 + intMins * 60;
  +               if((cTemp = strpbrk((cUtc), "+")) != NULL )
  +               {
  +                   timeInSecs += intSecs;
  +               }
  +               else
  +               {
  +                   timeInSecs -= intSecs;
  +               }
  +               pTm = localtime(&timeInSecs);
  +               memcpy(&m_TM, pTm, sizeof(tm));
  +               time_t t = mktime(&m_TM);
  +               if(t == -1)
  +                    return AXIS_FAIL;
  +               t = abs(t - d);
  +               pTm = gmtime(&t);
  +               memcpy(&m_TMUTC, pTm, sizeof(tm));
  +           }
               /*if the zone is not represented in the date*/
               else
               {
                   /*else it is assumed that the sent time is localtime*/
  +				//memcpy(&m_TMUTC, &m_TM, sizeof(tm));
                   time_t timeInSecs = mktime(&m_TM);
  +                if(timeInSecs == -1)
  +                    return AXIS_FAIL;
   				pTm = gmtime(&timeInSecs);
   				memcpy(&m_TMUTC, pTm, sizeof(tm));
               }
   
               break;
  +
           default:;
       }
   }
  @@ -558,57 +551,71 @@
   	return at.getDuration();
   }
   
  -//int main(int)
  -//{
  -    //AxisTime* objTime = new AxisTime();
  -    //===========================
  -    //objTime->setType(XSD_DATETIME);
  -    /*GMT in Z format*/
  +
  +/*int main2(int)
  +{
  +    AxisTime* objTime = new AxisTime();
  +*/
  +/*    //===========================
  +    objTime->setType(XSD_DATETIME);
  +    //GMT in Z format
       //objTime->setValue("2003-03-24T21:55:56Z");
  -    /*GMT in +/- format*/
  -    //objTime->setValue("2003-03-24T21:55:56+5:30");
  -    /*no timezone specified. assumed localtime*/
  +    //GMT in +/- format
  +    objTime->setValue("2003-03-24T21:55:56-5:30");
  +    //no timezone specified. assumed localtime
       //objTime->setValue("2003-03-24T21:55:56");
  -    //struct tm x;
  -    //x.tm_sec = 20;
  -    //x.tm_min = 55;
  -    //x.tm_hour = 21;
  -    //x.tm_mday = 27;
  -    //x.tm_mon = 11;
  -    //x.tm_year = 103;
  -    //objTime->serialize("", x);
  -    //objTime->mkCTime();
  -    //=============================
   
  +
  +    struct tm tmObj = objTime->getDateTime();
  +    AxisString str = objTime->serialize("", tmObj, XSD_DATETIME);
  +    printf("sent datetime:%s\n", "2003-03-24T21:55:56-5:30");
  +    printf("got  datetime:%s\n", str.c_str());
  +    
  +*/
  +    //=============================
           //===========================
  -    //objTime->setType(XSD_TIME);
  -    /*GMT in Z format*/
  +/*  objTime->setType(XSD_DATE);
  +    //GMT in Z format
       //objTime->setValue("2003-03-24Z");
  -    /*GMT in +/- format*/
  -    //objTime->setValue("2003-03-24+5:30");
  -    /*no timezone specified. assumed localtime*/
  +    //GMT in +/- format
  +    objTime->setValue("2003-03-24+5:30");
  +    //no timezone specified. assumed localtime
       //objTime->setValue("2003-03-24");
  -    //objTime->mkCTime();
  -    //=============================
   
  +
  +    struct tm tmObj = objTime->getDate();
  +    AxisString str = objTime->serialize("", tmObj, XSD_DATE);
  +    printf("sent date:%s\n", "2003-03-24+5:30");
  +    printf("got  date:%s\n", str.c_str());
  +*/
  +    //=============================
           //===========================
  -    //objTime->setType(XSD_TIME);
  -    /*GMT in Z format*/
  -    //objTime->setValue("21:55:56Z");
  -    /*GMT in +/- format*/
  -    //objTime->setValue("T21:55:56+5:30");
  -    /*no timezone specified. assumed localtime*/
  +/*    objTime->setType(XSD_TIME);
  +    //GMT in Z format
  +    //objTime->setValue("T1:3:3");
  +    //GMT in +/- format
  +    objTime->setValue("T21:55:56+5:30");
  +    //no timezone specified. assumed localtime
       //objTime->setValue("T21:55:56");
  -    //objTime->mkCTime();
  -    //===========================
  -
  -    //==========================
  -    //objTime->setType(XSD_DURATION);
  -    /*Duration in PnYnMnDTnHnMnS format*/
  -    //objTime->setValue("P100000Y3M21DT11H33M44S");
  -    //AxisString str = objTime->serialize("", objTime->m_Duration, XSD_DURATION);
  -    //printf("serialized string is: %s\n", str.c_str());
   
  +    struct tm tmObj = objTime->getTime();
  +    AxisString str = objTime->serialize("", tmObj, XSD_TIME);
  +    //printf("sent time:%s\n", "T1:1:1");
  +    printf("got  time:%s\n", str.c_str());
  +*/
  +    //===========================
  +    //==========================*/
  +/*    objTime->setType(XSD_DURATION);
  +    //Duration in PnYnMnDTnHnMnS format
  +    objTime->setValue("P59Y5M1DT11H26M29S");
  +    printf("m_Duration:%d\n", objTime->m_Duration);
  +    AxisString str = objTime->serialize("", objTime->m_Duration, XSD_DURATION);
  +    printf("sent string:%s\n", "P59Y5M1DT11H26M29S");
  +    printf("got  string:%s\n", str.c_str());
  +*/
       //==============================
  -    //return 0;
  -//}
  +/*
  +    return 0;
  +
  +}
  +*/
  \ No newline at end of file