GNSS core 'c' function library: converting time information. More...
#include <sys/timeb.h>#include <time.h>#include <math.h>#include "time_conversion.h"#include "ISConstants.h"
Go to the source code of this file.
Macros | |
| #define | TIMECONV_DAYS_IN_APR 30 |
| #define | TIMECONV_DAYS_IN_AUG 31 |
| #define | TIMECONV_DAYS_IN_DEC 31 |
| #define | TIMECONV_DAYS_IN_JAN 31 |
| #define | TIMECONV_DAYS_IN_JUL 31 |
| #define | TIMECONV_DAYS_IN_JUN 30 |
| #define | TIMECONV_DAYS_IN_MAR 31 |
| #define | TIMECONV_DAYS_IN_MAY 31 |
| #define | TIMECONV_DAYS_IN_NOV 30 |
| #define | TIMECONV_DAYS_IN_OCT 31 |
| #define | TIMECONV_DAYS_IN_SEP 30 |
| #define | TIMECONV_JULIAN_DATE_START_OF_GPS_TIME (2444244.5) |
| #define | TIMECONV_JULIAN_DATE_START_OF_PC_TIME (2440587.5) |
Functions | |
| int | TIMECONV_DetermineUTCOffset (double julian_date, unsigned char *utc_offset) |
| This function is a look up table to determine the UTC offset from the Julian Date. More... | |
| int | TIMECONV_GetDayOfWeekFromJulianDate (const double julian_date, unsigned char *day_of_week) |
| Computes the day of the week from the Julian date. More... | |
| int | TIMECONV_GetDayOfYear (const unsigned short utc_year, const unsigned char utc_month, const unsigned char utc_day, unsigned short *dayofyear) |
| Determines the day of year given the year, month, and day. More... | |
| int | TIMECONV_GetGPSTimeFromJulianDate (const double julian_date, const unsigned char utc_offset, unsigned short *gps_week, double *gps_tow) |
| Computes GPS time from the Julian date. More... | |
| int | TIMECONV_GetGPSTimeFromRinexTime (unsigned short utc_year, unsigned char utc_month, unsigned char utc_day, unsigned char utc_hour, unsigned char utc_minute, float utc_seconds, unsigned short *gps_week, double *gps_tow) |
| Computes GPS time from RINEX time. RINEX time looks like UTC but it is GPS time in year, month, day, hours, minutes, seconds. More... | |
| int | TIMECONV_GetGPSTimeFromUTCTime (unsigned short utc_year, unsigned char utc_month, unsigned char utc_day, unsigned char utc_hour, unsigned char utc_minute, float utc_seconds, unsigned short *gps_week, double *gps_tow) |
| Computes GPS time from UTC time. More... | |
| int | TIMECONV_GetGPSTimeFromYearAndDayOfYear (const unsigned short year, const unsigned short dayofyear, unsigned short *gps_week, double *gps_tow) |
| Determines the GPS time of the start of a day from the day of year and the year. More... | |
| int | TIMECONV_GetJulianDateFromGPSTime (const unsigned short gps_week, const double gps_tow, const unsigned char utc_offset, double *julian_date) |
| Computes the Julian date from GPS time. More... | |
| int | TIMECONV_GetJulianDateFromUTCTime (const unsigned short utc_year, const unsigned char utc_month, const unsigned char utc_day, const unsigned char utc_hour, const unsigned char utc_minute, const float utc_seconds, double *julian_date) |
| Computes the Julian date from UTC time. More... | |
| int | TIMECONV_GetNumberOfDaysInMonth (const unsigned short year, const unsigned char month, unsigned char *days_in_month) |
| Determines the number of days in a month, given the month and year. More... | |
| int | TIMECONV_GetSystemTime (unsigned short *utc_year, unsigned char *utc_month, unsigned char *utc_day, unsigned char *utc_hour, unsigned char *utc_minute, float *utc_seconds, unsigned char *utc_offset, double *julian_date, unsigned short *gps_week, double *gps_tow) |
| Obtains the UTC time, GPS time, and Julian date from PC system time. More... | |
| int | TIMECONV_GetUTCTimeFromGPSTime (unsigned short gps_week, double gps_tow, unsigned short *utc_year, unsigned char *utc_month, unsigned char *utc_day, unsigned char *utc_hour, unsigned char *utc_minute, float *utc_seconds) |
| Computes UTC time from GPS time. More... | |
| int | TIMECONV_GetUTCTimeFromJulianDate (const double julian_date, unsigned short *utc_year, unsigned char *utc_month, unsigned char *utc_day, unsigned char *utc_hour, unsigned char *utc_minute, float *utc_seconds) |
| Computes UTC time from the Julian date. More... | |
| int | TIMECONV_IsALeapYear (const unsigned short year) |
| Determines if the given year is a leap year. More... | |
| static int | TIMECONV_IsUTCTimeValid (const unsigned short utc_year, const unsigned char utc_month, const unsigned char utc_day, const unsigned char utc_hour, const unsigned char utc_minute, const float utc_seconds) |
GNSS core 'c' function library: converting time information.
REFERENCES
Definition in file time_conversion.c.
| #define TIMECONV_DAYS_IN_APR 30 |
Definition at line 58 of file time_conversion.c.
| #define TIMECONV_DAYS_IN_AUG 31 |
Definition at line 62 of file time_conversion.c.
| #define TIMECONV_DAYS_IN_DEC 31 |
Definition at line 66 of file time_conversion.c.
| #define TIMECONV_DAYS_IN_JAN 31 |
Definition at line 56 of file time_conversion.c.
| #define TIMECONV_DAYS_IN_JUL 31 |
Definition at line 61 of file time_conversion.c.
| #define TIMECONV_DAYS_IN_JUN 30 |
Definition at line 60 of file time_conversion.c.
| #define TIMECONV_DAYS_IN_MAR 31 |
Definition at line 57 of file time_conversion.c.
| #define TIMECONV_DAYS_IN_MAY 31 |
Definition at line 59 of file time_conversion.c.
| #define TIMECONV_DAYS_IN_NOV 30 |
Definition at line 65 of file time_conversion.c.
| #define TIMECONV_DAYS_IN_OCT 31 |
Definition at line 64 of file time_conversion.c.
| #define TIMECONV_DAYS_IN_SEP 30 |
Definition at line 63 of file time_conversion.c.
| #define TIMECONV_JULIAN_DATE_START_OF_GPS_TIME (2444244.5) |
Definition at line 54 of file time_conversion.c.
| #define TIMECONV_JULIAN_DATE_START_OF_PC_TIME (2440587.5) |
Definition at line 55 of file time_conversion.c.
| int TIMECONV_DetermineUTCOffset | ( | double | julian_date, |
| unsigned char * | utc_offset | ||
| ) |
This function is a look up table to determine the UTC offset from the Julian Date.
REFERENCES
| julian_date | Number of days since noon Universal Time Jan 1, 4713 BCE (Julian calendar) [days] |
| utc_offset | Integer seconds that GPS is ahead of UTC time, always positive [s], obtained from a look up table |
Definition at line 660 of file time_conversion.c.
| int TIMECONV_GetDayOfWeekFromJulianDate | ( | const double | julian_date, |
| unsigned char * | day_of_week | ||
| ) |
Computes the day of the week from the Julian date.
REFERENCES
http://en.wikipedia.org/wiki/Julian_day
| julian_date | Number of days since noon Universal Time Jan 1, 4713 BCE (Julian calendar) [days] |
| day_of_week | 0-Sunday, 1-Monday, 2-Tuesday, 3-Wednesday, 4-Thursday, 5-Friday, 6-Saturday []. |
Definition at line 262 of file time_conversion.c.
| int TIMECONV_GetDayOfYear | ( | const unsigned short | utc_year, |
| const unsigned char | utc_month, | ||
| const unsigned char | utc_day, | ||
| unsigned short * | dayofyear | ||
| ) |
Determines the day of year given the year, month, and day.
Definition at line 767 of file time_conversion.c.
| int TIMECONV_GetGPSTimeFromJulianDate | ( | const double | julian_date, |
| const unsigned char | utc_offset, | ||
| unsigned short * | gps_week, | ||
| double * | gps_tow | ||
| ) |
Computes GPS time from the Julian date.
REFERENCES
| julian_date | Number of days since noon Universal Time Jan 1, 4713 BCE (Julian calendar) [days] |
| utc_offset | Integer seconds that GPS is ahead of UTC time, always positive [s] |
| gps_week | GPS week (0-1024+) [week] |
| gps_tow | GPS time of week [s] |
Definition at line 360 of file time_conversion.c.
| int TIMECONV_GetGPSTimeFromRinexTime | ( | unsigned short | utc_year, |
| unsigned char | utc_month, | ||
| unsigned char | utc_day, | ||
| unsigned char | utc_hour, | ||
| unsigned char | utc_minute, | ||
| float | utc_seconds, | ||
| unsigned short * | gps_week, | ||
| double * | gps_tow | ||
| ) |
Computes GPS time from RINEX time. RINEX time looks like UTC but it is GPS time in year, month, day, hours, minutes, seconds.
REFERENCES
| utc_year | Universal Time Coordinated [year] |
| utc_month | Universal Time Coordinated [1-12 months] |
| utc_day | Universal Time Coordinated [1-31 days] |
| utc_hour | Universal Time Coordinated [hours] |
| utc_minute | Universal Time Coordinated [minutes] |
| utc_seconds | Universal Time Coordinated [s] |
| gps_week | GPS week (0-1024+) [week] |
| gps_tow | GPS time of week (0-604800.0) [s] |
Definition at line 544 of file time_conversion.c.
| int TIMECONV_GetGPSTimeFromUTCTime | ( | unsigned short | utc_year, |
| unsigned char | utc_month, | ||
| unsigned char | utc_day, | ||
| unsigned char | utc_hour, | ||
| unsigned char | utc_minute, | ||
| float | utc_seconds, | ||
| unsigned short * | gps_week, | ||
| double * | gps_tow | ||
| ) |
Computes GPS time from UTC time.
REFERENCES
| utc_year | Universal Time Coordinated [year] |
| utc_month | Universal Time Coordinated [1-12 months] |
| utc_day | Universal Time Coordinated [1-31 days] |
| utc_hour | Universal Time Coordinated [hours] |
| utc_minute | Universal Time Coordinated [minutes] |
| utc_seconds | Universal Time Coordinated [s] |
| gps_week | GPS week (0-1024+) [week] |
| gps_tow | GPS time of week (0-604800.0) [s] |
Definition at line 484 of file time_conversion.c.
| int TIMECONV_GetGPSTimeFromYearAndDayOfYear | ( | const unsigned short | year, |
| const unsigned short | dayofyear, | ||
| unsigned short * | gps_week, | ||
| double * | gps_tow | ||
| ) |
Determines the GPS time of the start of a day from the day of year and the year.
| gps_week | GPS week (0-1024+) [week] |
| gps_tow | GPS time of week (0-604800.0) [s] |
Definition at line 809 of file time_conversion.c.
| int TIMECONV_GetJulianDateFromGPSTime | ( | const unsigned short | gps_week, |
| const double | gps_tow, | ||
| const unsigned char | utc_offset, | ||
| double * | julian_date | ||
| ) |
Computes the Julian date from GPS time.
REFERENCES
| gps_week | GPS week (0-1024+) [week] |
| gps_tow | GPS time of week (0-604800.0) [s] |
| utc_offset | Integer seconds that GPS is ahead of UTC time, always positive [s] |
| julian_date | Number of days since noon Universal Time Jan 1, 4713 BCE (Julian calendar) [days] |
Definition at line 302 of file time_conversion.c.
| int TIMECONV_GetJulianDateFromUTCTime | ( | const unsigned short | utc_year, |
| const unsigned char | utc_month, | ||
| const unsigned char | utc_day, | ||
| const unsigned char | utc_hour, | ||
| const unsigned char | utc_minute, | ||
| const float | utc_seconds, | ||
| double * | julian_date | ||
| ) |
Computes the Julian date from UTC time.
| utc_year | Universal Time Coordinated [year] |
| utc_month | Universal Time Coordinated [1-12 months] |
| utc_day | Universal Time Coordinated [1-31 days] |
| utc_hour | Universal Time Coordinated [hours] |
| utc_minute | Universal Time Coordinated [minutes] |
| utc_seconds | Universal Time Coordinated [s] |
| julian_date | Number of days since noon Universal Time Jan 1, 4713 BCE (Julian calendar) [days] |
Definition at line 321 of file time_conversion.c.
| int TIMECONV_GetNumberOfDaysInMonth | ( | const unsigned short | year, |
| const unsigned char | month, | ||
| unsigned char * | days_in_month | ||
| ) |
Determines the number of days in a month, given the month and year.
REFERENCES
| year | Universal Time Coordinated [year] |
| month | Universal Time Coordinated [1-12 months] |
| days_in_month | Days in the specified month [1-28|29|30|31 days] |
Definition at line 693 of file time_conversion.c.
| int TIMECONV_GetSystemTime | ( | unsigned short * | utc_year, |
| unsigned char * | utc_month, | ||
| unsigned char * | utc_day, | ||
| unsigned char * | utc_hour, | ||
| unsigned char * | utc_minute, | ||
| float * | utc_seconds, | ||
| unsigned char * | utc_offset, | ||
| double * | julian_date, | ||
| unsigned short * | gps_week, | ||
| double * | gps_tow | ||
| ) |
Obtains the UTC time, GPS time, and Julian date from PC system time.
| utc_year | Universal Time Coordinated [year] |
| utc_month | Universal Time Coordinated [1-12 months] |
| utc_day | Universal Time Coordinated [1-31 days] |
| utc_hour | Universal Time Coordinated [hours] |
| utc_minute | Universal Time Coordinated [minutes] |
| utc_seconds | Universal Time Coordinated [s] |
| utc_offset | Integer seconds that GPS is ahead of UTC time, always positive [s], obtained from a look up table |
| julian_date | Number of days since noon Universal Time Jan 1, 4713 BCE (Julian calendar) [days] |
| gps_week | GPS week (0-1024+) [week] |
| gps_tow | GPS time of week (0-604800.0) [s] |
Definition at line 128 of file time_conversion.c.
| int TIMECONV_GetUTCTimeFromGPSTime | ( | unsigned short | gps_week, |
| double | gps_tow, | ||
| unsigned short * | utc_year, | ||
| unsigned char * | utc_month, | ||
| unsigned char * | utc_day, | ||
| unsigned char * | utc_hour, | ||
| unsigned char * | utc_minute, | ||
| float * | utc_seconds | ||
| ) |
Computes UTC time from GPS time.
REFERENCES
| gps_week | GPS week (0-1024+) [week] |
| gps_tow | GPS time of week (0-604800.0) [s] |
| utc_year | Universal Time Coordinated [year] |
| utc_month | Universal Time Coordinated [1-12 months] |
| utc_day | Universal Time Coordinated [1-31 days] |
| utc_hour | Universal Time Coordinated [hours] |
| utc_minute | Universal Time Coordinated [minutes] |
| utc_seconds | Universal Time Coordinated [s] |
Definition at line 597 of file time_conversion.c.
| int TIMECONV_GetUTCTimeFromJulianDate | ( | const double | julian_date, |
| unsigned short * | utc_year, | ||
| unsigned char * | utc_month, | ||
| unsigned char * | utc_day, | ||
| unsigned char * | utc_hour, | ||
| unsigned char * | utc_minute, | ||
| float * | utc_seconds | ||
| ) |
Computes UTC time from the Julian date.
REFERENCES
| julian_date | Number of days since noon Universal Time Jan 1, 4713 BCE (Julian calendar) [days] |
| utc_year | Universal Time Coordinated [year] |
| utc_month | Universal Time Coordinated [1-12 months] |
| utc_day | Universal Time Coordinated [1-31 days] |
| utc_hour | Universal Time Coordinated [hours] |
| utc_minute | Universal Time Coordinated [minutes] |
| utc_seconds | Universal Time Coordinated [s] |
Definition at line 390 of file time_conversion.c.
| int TIMECONV_IsALeapYear | ( | const unsigned short | year | ) |
Determines if the given year is a leap year.
Definition at line 734 of file time_conversion.c.
|
static |
| utc_year | Universal Time Coordinated [year] |
| utc_month | Universal Time Coordinated [1-12 months] |
| utc_day | Universal Time Coordinated [1-31 days] |
| utc_hour | Universal Time Coordinated [hours] |
| utc_minute | Universal Time Coordinated [minutes] |
| utc_seconds | Universal Time Coordinated [s] |
Definition at line 81 of file time_conversion.c.