00001
00005 #ifndef _das2_units_h_
00006 #define _das2_units_h_
00007
00008 #include <stdbool.h>
00009
00010 #ifndef _das2_units_c_
00011
00012 extern const char* UNIT_US2000;
00013 extern const char* UNIT_MJ1958;
00014 extern const char* UNIT_T2000;
00015 extern const char* UNIT_T1970;
00016 extern const char* UNIT_UTC;
00017
00018
00019 extern const char* UNIT_SECONDS;
00020 extern const char* UNIT_HOURS;
00021 extern const char* UNIT_MILLISECONDS;
00022 extern const char* UNIT_MICROSECONDS;
00023
00024 extern const char* UNIT_HERTZ;
00025 extern const char* UNIT_KILO_HERTZ;
00026 extern const char* UNIT_MEGA_HERTZ;
00027 extern const char* UNIT_E_SPECDENS;
00028 extern const char* UNIT_B_SPECDENS;
00029 extern const char* UNIT_NT;
00030
00031 extern const char* UNIT_NUMBER_DENS;
00032
00033 extern const char* UNIT_DB;
00034
00035 extern const char* UNIT_KM;
00036
00037 extern const char* UNIT_DEGREES;
00038 extern const char* UNIT_DIMENSIONLESS;
00039
00040 #endif
00041
00076 typedef const char* UnitType;
00077
00079 #define FILL_VALUE -1e31
00080
00086 const char* Units_toStr( UnitType unit );
00087
00092 UnitType Units_fromStr( const char * string );
00093
00094
00099 bool Units_canConvert(UnitType fromUnits , UnitType toUnits);
00100
00101
00105 double Units_convertTo( UnitType toUnits, double value, UnitType fromUnits );
00106
00121 void Units_double2Time(double time, UnitType units,
00122 int *year, int *month, int *dom, int *hour, int *minute, double *seconds);
00123
00128 char* Units_double2TimeStr( double time, UnitType units );
00129
00133 double Units_time2Double(int year, int month, int dom, int hour, int minute,
00134 double seconds, UnitType units );
00135
00140 double Units_timeStr2Double(const char* timeString, UnitType units );
00141
00142
00143 double convertToUS2000( double value, UnitType fromUnits );
00144 double convertFromUS2000( double value, UnitType toUnits );
00145 double secondsToUnitsOffsetFactor( UnitType toUnits );
00146
00147
00148
00149
00150 double getSecondsSinceMidnight( double timeDouble, UnitType units );
00151
00152
00153 int getJulianDay( double timeDouble, UnitType units );
00154
00155
00156 #endif