Changeset 544 for XIOS/branchs


Ignore:
Timestamp:
12/16/14 17:09:58 (9 years ago)
Author:
rlacroix
Message:

Fix: The conversion of a date to a number of seconds since the time origin was wrong.

Remove the work around in nc4_data_output.cpp which hid this bug.

Also backport this fix in XIOS 1.0.

Location:
XIOS/branchs/xios-1.0/src
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • XIOS/branchs/xios-1.0/src/date.cpp

    r501 r544  
    119119      { 
    120120         // Todo : Tester si la date courante est supérieure à la date initiale. 
    121          Time retvalue = - relCalendar.getNbSecond(relCalendar.getInitDate()) 
     121         Time retvalue = - relCalendar.getNbSecond(relCalendar.getTimeOrigin()) 
    122122                         + relCalendar.getNbSecond(*this); 
    123123 
  • XIOS/branchs/xios-1.0/src/date.hpp

    r501 r544  
    3232            friend StdIStream & operator>>(StdIStream & in, CDate & date); // Non testée. 
    3333 
    34             operator Time(void) const;  // Retourne le nombre de secondes écoulées depuis la date d'origine définie dans le calendrier. 
     34            //!< Return the number of seconds since the time origin fixed when creating the calendar 
     35            operator Time(void) const; 
    3536 
    3637            /// Traitements /// 
  • XIOS/branchs/xios-1.0/src/output/nc4_data_output.cpp

    r501 r544  
    940940        if (wtime) 
    941941        { 
    942           time_counter(0)= (Time(*field->last_Write_srv)+Time(*field->lastlast_Write_srv))/2 -Time(context->calendar->getTimeOrigin()); 
     942          time_counter(0)= (Time(*field->last_Write_srv) + Time(*field->lastlast_Write_srv)) / 2; 
    943943          if (field->foperation->timeType() == func::CFunctor::instant) 
    944             time_data(0) = Time(*field->last_Write_srv)-Time(context->calendar->getTimeOrigin()); 
     944            time_data(0) = Time(*field->last_Write_srv); 
    945945          else if (field->foperation->timeType() == func::CFunctor::centered) time_data(0) = time_counter(0); 
    946946 
    947           time_counter_bound(0) = Time(*field->lastlast_Write_srv) - Time(context->calendar->getTimeOrigin()); 
    948           time_counter_bound(1) = Time(*field->last_Write_srv) - Time(context->calendar->getTimeOrigin()); 
     947          time_counter_bound(0) = Time(*field->lastlast_Write_srv); 
     948          time_counter_bound(1) = Time(*field->last_Write_srv); 
    949949          if (field->foperation->timeType() == func::CFunctor::instant) 
    950             time_data_bound(0) = time_data_bound(1) = Time(*field->last_Write_srv)-Time(context->calendar->getTimeOrigin()); 
     950            time_data_bound(0) = time_data_bound(1) = Time(*field->last_Write_srv); 
    951951          else if (field->foperation->timeType() == func::CFunctor::centered) 
    952952          { 
Note: See TracChangeset for help on using the changeset viewer.