|
SDDS ToolKit Programs and Libraries for C and Python
|
Provides functions for converting and manipulating time representations, including leap year calculations, Julian day conversions, and epoch time breakdowns.
Definition in file timeconvert.c.
#include "mdb.h"#include "time_utils.h"#include <time.h>Go to the source code of this file.
Functions | |
| short | IsLeapYear (short year) |
| Determines whether a given year is a leap year. | |
| short | JulianDayFromMonthDay (short month, short day, short year, short *julianDay) |
| Computes the Julian day number from a calendar date. | |
| short | MonthDayFromJulianDay (short julianDay, short year, short *month, short *day) |
| Converts a Julian day number to month and day components. | |
| short | TimeEpochToBreakdown (short *year, short *jDay, short *month, short *day, double *hour, double epochTime) |
| Breaks down epoch time into its constituent components. | |
| short | TimeEpochToText (char *text, double epochTime) |
| Converts epoch time to a formatted text string. | |
| short | TimeBreakdownToEpoch (short year, short jDay, short month, short day, double hour, double *epochTime) |
| Converts a broken-down time into epoch time. | |
| short IsLeapYear | ( | short | year | ) |
Determines whether a given year is a leap year.
Years below 100 are interpreted as 19xx if greater than 95, otherwise 20xx.
| year | The year to evaluate. |
Definition at line 28 of file timeconvert.c.
| short JulianDayFromMonthDay | ( | short | month, |
| short | day, | ||
| short | year, | ||
| short * | julianDay ) |
Computes the Julian day number from a calendar date.
| month | Month of the year (1-12). |
| day | Day of the month. |
| year | Year value. |
| julianDay | Pointer to store the resulting Julian day number. |
Definition at line 78 of file timeconvert.c.
| short MonthDayFromJulianDay | ( | short | julianDay, |
| short | year, | ||
| short * | month, | ||
| short * | day ) |
Converts a Julian day number to month and day components.
| julianDay | The Julian day number to convert. |
| year | Year corresponding to the Julian day. |
| month | Pointer to store the resulting month (1-12). |
| day | Pointer to store the resulting day of the month. |
Definition at line 105 of file timeconvert.c.
| short TimeBreakdownToEpoch | ( | short | year, |
| short | jDay, | ||
| short | month, | ||
| short | day, | ||
| double | hour, | ||
| double * | epochTime ) |
Converts a broken-down time into epoch time.
This function takes individual time components and converts them into epoch time. It handles both Julian day and standard month/day formats based on the input.
| year | The year. |
| jDay | The Julian day number. |
| month | The month. |
| day | The day of the month. |
| hour | The fractional hour. |
| epochTime | Pointer to store the resulting epoch time. |
Definition at line 210 of file timeconvert.c.
| short TimeEpochToBreakdown | ( | short * | year, |
| short * | jDay, | ||
| short * | month, | ||
| short * | day, | ||
| double * | hour, | ||
| double | epochTime ) |
Breaks down epoch time into its constituent components.
This function decomposes epoch time into year, Julian day, month, day, and fractional hour components.
| year | Pointer to store the year. |
| jDay | Pointer to store the Julian day. |
| month | Pointer to store the month. |
| day | Pointer to store the day. |
| hour | Pointer to store the fractional hour. |
| epochTime | The epoch time to be broken down. |
Definition at line 143 of file timeconvert.c.
| short TimeEpochToText | ( | char * | text, |
| double | epochTime ) |
Converts epoch time to a formatted text string.
This function formats epoch time into a human-readable string in the format "YYYY/MM/DD HH:MM:SS.FFFF".
| text | Buffer to store the formatted time string. |
| epochTime | The epoch time to be converted. |
Definition at line 183 of file timeconvert.c.