Пропустить основной контент

//ERDDAP/com.cohort.util/ScriptCalendar2/getTimeBaseAndFactor

getTimeBaseAndFactor

[JVM]
open fun getTimeBaseAndFactor(tsUnits: String, timeZone: TimeZone): Array<Double>

This converts a string "[units] since [isoDate]" (e.g., "minutes since 1985-01-01") into a baseSeconds (seconds since 1970-01-01) and a factor ("minutes" returns 60). So simplistically, epochSeconds = storedTime * factor + baseSeconds. Or simplistically, storedTime = (epochSeconds - baseSeconds) / factor.

WARNING: don't use the equations above. Use unitsSinceToEpochSeconds or epochSecondsToUnitsSince which correctly handle special cases.

Return

double[]{baseSeconds, factorToGetSeconds}

Parameters

JVM

tsUnitse.g., "minutes since 1985-01-01". This may include hours, minutes, seconds, decimal, and Z or timezone offset (default=Zulu). This is lenient.
timeZoneIs a TimeZone from TimeZone.gettimeZone(id). For valid ID's, see the "TZ database names" column in the table at https://en.wikipedia.org/wiki/List_of_tz_database_time_zones If this is null, Zulu will be used.

Throws

RuntimeExceptionif trouble (tsUnits is null or invalid)