static void ecl_sum_tstep_set_time_info( ecl_sum_tstep_type * tstep , const ecl_smspec_type * smspec ) { int date_day_index = ecl_smspec_get_date_day_index( smspec ); int date_month_index = ecl_smspec_get_date_month_index( smspec ); int date_year_index = ecl_smspec_get_date_year_index( smspec ); int sim_time_index = ecl_smspec_get_time_index( smspec ); time_t sim_start = ecl_smspec_get_start_time( smspec ); if (sim_time_index >= 0) { float sim_time = tstep->data[ sim_time_index ]; double sim_seconds = sim_time * ecl_smspec_get_time_seconds( smspec ); ecl_sum_tstep_set_time_info_from_seconds( tstep , sim_start , sim_seconds ); } else if ( date_day_index >= 0) { int sec = 0; int min = 0; int hour = 0; int day = util_roundf(tstep->data[date_day_index]); int month = util_roundf(tstep->data[date_month_index]); int year = util_roundf(tstep->data[date_year_index]); time_t sim_time = util_make_datetime(sec , min , hour , day , month , year); ecl_sum_tstep_set_time_info_from_date( tstep , sim_start , sim_time ); } else util_abort("%s: Hmmm - could not extract date/time information from SMSPEC header file? \n",__func__); }
ecl_sum_tstep_type * ecl_sum_tstep_alloc_new( int report_step , int ministep , float sim_days , const ecl_smspec_type * smspec ) { ecl_sum_tstep_type * tstep = ecl_sum_tstep_alloc( report_step , ministep , smspec ); const float_vector_type * default_data = ecl_smspec_get_params_default( smspec ); float_vector_memcpy_data( tstep->data , default_data ); ecl_sum_tstep_set_time_info_from_days( tstep , ecl_smspec_get_start_time( smspec ) , sim_days ); ecl_sum_tstep_iset( tstep , ecl_smspec_get_time_index( smspec ) , sim_days ); return tstep; }