src/grib_accessor_class_bufr_extract_datetime_subsets.c
/* Convert input date to Julian number. If date is invalid, return -1 */
Convert input date to Julian number. If date is invalid, return -1
Convert input date to Julian number . If date is invalid return - 1
static double date_to_julian(long year, long month, long day, long hour, long minute, double second)
{
    double result = 0;
    long lSecond = (long)second;
    grib_datetime_to_julian(year, month, day, hour, minute, lSecond, &result);
    {
        long year1, month1, day1, hour1, minute1, lSecond1;
        grib_julian_to_datetime(result, &year1, &month1, &day1, &hour1, &minute1, &lSecond1);
        if (year1 != year || month1 != month || day1 != day || minute1 != minute || lSecond1 != lSecond) {
            return -1; 
        }
    }
    grib_datetime_to_julian_d(year, month, day, hour, minute, second, &result);
    return result;
}
static double date_to_julian ( long year , long month , long day , long hour , long minute , double second ) { double result = 0 ; long lSecond = ( long ) second ; grib_datetime_to_julian ( year , month , day , hour , minute , lSecond , & result ) ; { long year1 , month1 , day1 , hour1 , minute1 , lSecond1 ; grib_julian_to_datetime ( result , & year1 , & month1 , & day1 , & hour1 , & minute1 , & lSecond1 ) ; if ( year1 != year || month1 != month || day1 != day || minute1 != minute || lSecond1 != lSecond ) { return -1 ; } } grib_datetime_to_julian_d ( year , month , day , hour , minute , second , & result ) ; return result ; }
Convert input date to Julian number.
Convert input date to Julian number .
/* For validating the date/time, we specify seconds as an integer */ /* Check conversion worked by going other way */ /* Failed. Invalid date*/ /* Now get the proper Julian number specifying the seconds in double precision */