Re: CIMDataTime format when the value is Date type.

Ashok K Pathak <[email protected]>
Newsgroups gmane.network.open-pegasus.general
Message-ID <OF12C3F02C.0B57F8D6-ON6525790F.005DB283-85257910.000EF74B@in.ibm.com>

In Pegasus CIMDateTime objects which are not explicitly initialized will be
implicitly initialized with the null time interval:

00000000000000.000000:000

As in default ctor  sign is set to ( _rep->sign = ':';)  which eventually
set  time interval (implicitly )  . Below is the trail of code which does
this

 CIMDateTime dt;
 cout <<  dt.toString() ;
>>>
00000000000000.000000:000
<<<


CIMDateTime::CIMDateTime()
{
    _rep = new CIMDateTimeRep;
    memset(_rep, 0, sizeof(CIMDateTimeRep));
    _rep->sign = ':';
}

String CIMDateTime::toString() const
{
    Char16 str[26];
    _toChar16Str(_rep, str);
    return String(str, 25);
}


static void _toChar16Str(const CIMDateTimeRep* rep, Char16* data_)
{
    Uint16* data = (Uint16*)data_;

    if (rep->sign == ':')
    {
        // DDDDDDDDHHMMSS.MMMMMM:000

        Uint64 usec = rep->usec;
        Uint32 microseconds = Uint32(usec % SECOND);
        Uint32 seconds = Uint32((usec / SECOND) % 60);
        Uint32 minutes = Uint32((usec / MINUTE) % 60);
        Uint32 hours = Uint32((usec / HOUR) % 24);
        Uint32 days = Uint32((usec / DAY));
        ................
    }
    else
    {
        // YYYYMMDDHHMMSS.MMMMMMSUTC

        Uint64 usec = rep->usec;
        Uint32 microseconds = Uint32(usec % SECOND);
        Uint32 seconds = Uint32((usec / SECOND) % 60);
        Uint32 minutes = Uint32((usec / MINUTE) % 60);
    .....................
    }

So if there is a need to support default (implicit)format as
“00000000000000.000000+000”.  You can open a  defect and we will look into
it

Regards
Ashok




                                                                           
             "Yaligar, Veeresh                                             
             S \(USD SRDL\)"                                               
             <veeresh.yaligar@                                          To 
             hp.com>                   "[email protected]"         
                                       <[email protected]>         
             09/16/11 01:41 PM                                          cc 
                                                                           
                                                                   Subject 
                                       CIMDataTime format when the value   
                                       is Date type.                       
                                                                           
                                                                           
                                                                           
                                                                           
                                                                           
                                                                           




Hi All
As per the documentation of CIMDataTime (
http://www.openpegasus.org/manual/CIMDateTime.html)  any CIM property of
CIMDataTime if not initialized will be of value “00000000000000.000000:000”
which is of type interval.
Now, if a property of a CIM object is required to hold the Date value
instead of interval ( for example Manufacture Date) and if that value is
not explicitly set then it should have been implicitly set with some null
value in the format of Date instead of interval for example
“00000000000000.000000+000” or an empty string “”. I guess this would have
been the desired behavior. Because one of our client application try to
parse the date field and expects it in the Date format. If we are not
filling it in the provider then there is no way to get it to the form as
“00000000000000.000000+000”.
Any thoughts how to handle this use case?
Thanks in advance.
Veeresh
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.