Grassroots Infrastructure
The Grassroots Infrastructure is a suite of computing tools to help users and developers use scientific data infrastructure that can easily be interconnected.
time_util.h File Reference
#include <time.h>
#include "typedefs.h"
#include "grassroots_util_library.h"
Include dependency graph for time_util.h:

Go to the source code of this file.

Functions

bool ConvertCompactStringToTime (const char *const time_s, struct tm *time_p, int *offset_p)
 Convert a string that is of the form YYYYMMDD or YYYYMMDDhhmmss into a struct tm. More...
 
bool ConvertCompactStringToEpochTime (const char *const time_s, time_t *time_p)
 Convert a string that is of the form YYYYMMDD or YYYYMMDDhhmmss into a time_t. More...
 
bool ConvertDropboxStringToTime (const char *const time_s, struct tm *time_p, int *offset_p)
 Convert a string that is of the form "Sat, 21 Aug 2010 22:31:20 +0000" ("%a, %d %b %Y %H:%M:%S %z") into a struct tm. More...
 
bool ConvertDropboxStringToEpochTime (const char *const time_s, time_t *time_p)
 Convert a string that is of the form "Sat, 21 Aug 2010 22:31:20 +0000" ("%a, %d %b %Y %H:%M:%S %z") into a time_t. More...
 
bool GetPresentTime (struct tm *tm_p)
 Get the current time. More...
 
char * GetTimeAsString (const struct tm *const time_p, const bool include_time_flag, const char *time_delimiter_p)
 Get a time as a string in the ISO 8601 format. More...
 
void FreeTimeString (char *time_s)
 Free a string previsouly-generated from GetTimeAsString(). More...
 
bool SetTimeFromString (struct tm *const time_p, const char *time_s)
 Set the time from a string in the ISO 8601 format. More...
 
bool SetTimeFromDDMMYYYYString (struct tm *const time_p, const char *time_s)
 Set the time from a string of the form DD-MM-YYYY. More...
 
struct tm * GetTimeFromString (const char *time_s)
 
void AddIntervalToTime (struct tm *time_p, const int days)
 Add a number of days to a time. More...
 
struct tm * AllocateTime (void)
 Allocate a struct tm variable and set all of its values to 0. More...
 
void FreeTime (struct tm *time_p)
 Free a struct tm variable allocated by AllocateTime(). More...
 
void CopyTime (const struct tm *src_p, struct tm *dest_p)
 Copy the values from one struct tm to another. More...
 
struct tm * DuplicateTime (const struct tm *src_p)
 Make a deep copy of a struct tm. More...
 
void SetDateValuesForTime (struct tm *time_p, const int year, const int month, const int day)
 Set the year, month and day values for a struct tm. More...
 
void ClearTime (struct tm *time_p)
 
bool IsValidDate (struct tm *time_p)
 
int CompareDates (const struct tm *time_0_p, const struct tm *time_1_p, const bool dates_only_flag)
 Compare two dates chronologically. More...
 
bool MayStringIncludeTime (const char *const time_s)
 
void FreeTimeArray (struct tm **values_pp, const size_t num_values)
 

Function Documentation

◆ GetTimeFromString()

struct tm* GetTimeFromString ( const char *  time_s)

◆ ClearTime()

void ClearTime ( struct tm *  time_p)

◆ IsValidDate()

bool IsValidDate ( struct tm *  time_p)

◆ MayStringIncludeTime()

bool MayStringIncludeTime ( const char *const  time_s)

◆ FreeTimeArray()

void FreeTimeArray ( struct tm **  values_pp,
const size_t  num_values 
)