Changeset 544


Ignore:
Timestamp:
12/16/14 17:09:58 (10 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
Files:
6 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          { 
  • XIOS/trunk/src/date.cpp

    r532 r544  
    131131 
    132132         // Todo : Tester si la date courante est supérieure à la date initiale. 
    133          Time retvalue = - c.getNbSecond(c.getInitDate()) 
     133         Time retvalue = - c.getNbSecond(c.getTimeOrigin()) 
    134134                         + c.getNbSecond(*this); 
    135135 
  • XIOS/trunk/src/date.hpp

    r532 r544  
    3535            friend StdIStream & operator>>(StdIStream & in, CDate & date); // Non testée. 
    3636 
    37             operator Time(void) const;  // Retourne le nombre de secondes écoulées depuis la date d'origine définie dans le calendrier. 
     37            //!< Return the number of seconds since the time origin fixed when creating the calendar 
     38            operator Time(void) const; 
    3839 
    3940            /// Traitements /// 
  • XIOS/trunk/src/output/nc4_data_output.cpp

    r540 r544  
    961961        if (wtime) 
    962962        { 
    963           time_counter(0)= (Time(*field->last_Write_srv)+Time(*field->lastlast_Write_srv))/2 -Time(context->calendar->getTimeOrigin()); 
     963          time_counter(0)= (Time(*field->last_Write_srv) + Time(*field->lastlast_Write_srv)) / 2; 
    964964          if (field->foperation->timeType() == func::CFunctor::instant) 
    965             time_data(0) = Time(*field->last_Write_srv)-Time(context->calendar->getTimeOrigin()); 
     965            time_data(0) = Time(*field->last_Write_srv); 
    966966          else if (field->foperation->timeType() == func::CFunctor::centered) time_data(0) = time_counter(0); 
    967967 
    968           time_counter_bound(0) = Time(*field->lastlast_Write_srv) - Time(context->calendar->getTimeOrigin()); 
    969           time_counter_bound(1) = Time(*field->last_Write_srv) - Time(context->calendar->getTimeOrigin()); 
     968          time_counter_bound(0) = Time(*field->lastlast_Write_srv); 
     969          time_counter_bound(1) = Time(*field->last_Write_srv); 
    970970          if (field->foperation->timeType() == func::CFunctor::instant) 
    971             time_data_bound(0) = time_data_bound(1) = Time(*field->last_Write_srv)-Time(context->calendar->getTimeOrigin()); 
     971            time_data_bound(0) = time_data_bound(1) = Time(*field->last_Write_srv); 
    972972          else if (field->foperation->timeType() == func::CFunctor::centered) 
    973973          { 
Note: See TracChangeset for help on using the changeset viewer.