[mistake, no bug] getUniversalClock()->setGregorianDateTime

nargil

04-01-2009 21:57:51

I use trunk.
There is something wrong with the Month in setGregorianDateTime(). I need to add +1 to the month value in order to recieve back the enetered value by

getGregorianDateTimeFromJulianDay()

cdleonard

05-01-2009 05:33:59

Are you sure about this?

Those functions are tested to roundtrip at the start of CaelumDemo. I'm fairly confident they work correctly.

Try to reproduce your issue in code. Maybe it only happens for a certain date range?

nargil

05-01-2009 13:53:19

Ok, sorry for confusing. I found it's not caelum, but wxWidgets / wxPropertyGrid / wxDateProperty related;

stealth977

10-02-2009 15:08:58


int year,month,day,hour,minute;
Caelum::LongReal second;
Caelum::LongReal jd = m_Handle->getUniversalClock()->getJulianDay();
Caelum::Astronomy::getGregorianDateTimeFromJulianDay(jd,year,month,day,hour,minute,second);
hour = 17;
m_Handle->getUniversalClock()->setGregorianDateTime(year,month,day,hour,minute,second);
jd = m_Handle->getUniversalClock()->getJulianDay();
Caelum::Astronomy::getGregorianDateTimeFromJulianDay(jd,year,month,day,hour,minute,second);


result of 1st GregorianDate = 2000 , 1, 1, 12, 0, 0 ,0.0000000000
Changed Hour to 17
result of 2nd GregorianDate = 2000 , 1, 1, 18, 0, 0 ,0.0000000000

Do you have any idea why this is happening?