|
My Project
|
#include <locale.h>#include <stdio.h>#include <stdlib.h>#include <ctype.h>#include <string.h>#include <unistd.h>#include <time.h>#include "include/datetime.h"#include "include/substitutions.h"
Functions | |
| int | isdate (char *str) |
| int | isdate2 (char *str, char *intdate) |
| int | isdate3 (char *str, char *intdate) |
| int | isdate4 (int dateint, int *year, int *month, int *day) |
| int | istime (char *str) |
| int | isdatetime (char *str, char *intdate) |
| int | get_datetime (char *str, struct tm *date) |
| int | get_date (char *str, struct tm *date) |
| long int | math_div (long int a, long int b) |
| int | isleapyear (long year) |
| long int | leaps_between (long int year1, long int year2) |
| void | time_to_tm (time_t totalsecs, int offset, struct tm *result) |
Variables | |
| static const unsigned short | __mon_yday [2][13] |
| int get_date | ( | char * | str, |
| struct tm * | date | ||
| ) |
Reads date from a standard string representation of date.
| str | Pointer to string that contains date in one of the formats YYYY-MM-DD, DD/MM/YYYY, DD.MM.YYYY, DD/MM/YY, or DD.MM.YYYY. This string is not modified. |
| date | Pointer to allocated struct tm where the date is written |
References isdate(), isdate2(), and isdate3().

| int get_datetime | ( | char * | str, |
| struct tm * | date | ||
| ) |
Reads time and date from a standard string representation of date and time.
| str | Pointer to string that contains date and time in one of the formats YYYY-MM-DD hh:mm:ss, DD.MM.YYYY hh:mm:ss, or DD/MM/YY hh:mm:ss This string is not modified. |
| date | Pointer to allocated struct tm where date and time is written |
References isdatetime().

| int isdate | ( | char * | str | ) |
Check if specified string contains date in correct international format (YYYY-MM-DD). String must start with date, but any contents after it is ignored.
| str | String to be checked; not changed in this routine |
Referenced by get_date(), and isdatetime().
| int isdate2 | ( | char * | str, |
| char * | intdate | ||
| ) |
Check if specified string contains date in correct format (DD.MM.YYYY or DD/MM/YYYY). String must start with date, but any contents after it is ignored.
| str | String to be checked; not changed in this routine |
| intdate | Pointer to allocated string where date is written in international format; enter NULL, if not needed. |
Referenced by get_date(), and isdatetime().
| int isdate3 | ( | char * | str, |
| char * | intdate | ||
| ) |
Check if specified string contains date in correct format (DD.MM.YY or DD/MM/YY). String must start with date, but any contents after it is ignored.
| str | String to be checked; not changed in this routine |
| intdate | Pointer to allocated string where date is written in international format; enter NULL, if not needed. |
Referenced by get_date(), and isdatetime().
| int isdate4 | ( | int | dateint, |
| int * | year, | ||
| int * | month, | ||
| int * | day | ||
| ) |
Check if specified integer contains date in format YYYYMMDD.
| dateint | Integer to be checked; not changed in this routine |
| year | Year is written in this pointer; enter NULL if not needed |
| month | Month is written in this pointer; enter NULL if not needed |
| day | Day is written in this pointer; enter NULL if not needed |
| int isdatetime | ( | char * | str, |
| char * | intdate | ||
| ) |
Check if specified string contains date and time in correct format (YYYY-MM-DD hh:mm:ss, DD.MM.YYYY hh:mm:ss, or DD.MM.YY hh:mm:ss). String must start with date, but any contents after time is ignored.
| str | String to be checked; not changed in this routine |
| intdate | Pointer to allocated string where date and time is written in international format (YYYY-MM-DD hh:mm:ss); enter NULL, if not needed. |
References isdate(), isdate2(), isdate3(), and istime().
Referenced by get_datetime().

| int isleapyear | ( | long | year | ) |
Return nonzero if 'year' is a leap year.
Referenced by time_to_tm().
| int istime | ( | char * | str | ) |
Check if specified string contains time in correct format (hh:mm:ss). String must start with time, but any contents after it is ignored.
| str | String to be checked; not changed in this routine |
Referenced by iftRead(), and isdatetime().
| long int leaps_between | ( | long int | year1, |
| long int | year2 | ||
| ) |
Calculates the number of leap years between year1 and year2.
References math_div().
Referenced by time_to_tm().

| long int math_div | ( | long int | a, |
| long int | b | ||
| ) |
Referenced by leaps_between(), and time_to_tm().
| void time_to_tm | ( | time_t | totalsecs, |
| int | offset, | ||
| struct tm * | result | ||
| ) |
Convert calendar time to local broken-down time. This function is copied from GNU C Library with tiny modifications.
| totalsecs | number of seconds elapsed since 00:00:00 on January 1, 1970, UTC; can be negative to represent times before 1970 |
| offset | offset seconds adding to totalsecs (e.g. -timezone) |
| result | pointer to struct tm variable to receive broken-down time |
References __mon_yday, isleapyear(), leaps_between(), and math_div().

|
static |
Referenced by time_to_tm().