|
SDDS ToolKit Programs and Libraries for C and Python
|
This file provides functions for creating time-based filenames, timestamps, and for breaking down and retrieving the current time in various formats.
Definition in file logfile_gener.c.
#include "mdb.h"#include <unistd.h>#include <time.h>Go to the source code of this file.
Functions | |
| char * | makeTimeStamp (double Time) |
| Create a human-readable timestamp from the given time in seconds since the Epoch. | |
| void | getTimeBreakdown (double *ptrTime, double *ptrDay, double *ptrHour, double *ptrJulianDay, double *ptrMonth, double *ptrYear, char **ptrTimeStamp) |
| Retrieve detailed time breakdown (day, hour, julian day, month, year, and timestamp). | |
| double | getHourOfDay () |
| Get the current hour of the day (0-23, possibly fractional). | |
| void | makeTimeBreakdown (double Time, double *ptrTime, double *ptrDay, double *ptrHour, double *ptrJulianDay, double *ptrMonth, double *ptrYear, char **ptrTimeStamp) |
| Break down a given time into multiple components (time, day, hour, Julian day, month, year, and timestamp). | |
| double | computeYearStartTime (double StartTime) |
| Compute the start time of the year for the given time. | |
| double | getTimeInSecs () |
| Get the current time in seconds since the Epoch with high resolution. | |
| long double | getLongDoubleTimeInSecs () |
| Get the current time in seconds since the Epoch as a long double for higher precision. | |
| char * | MakeGenerationFilename (char *rootname, long digits, char *delimiter, char *lastFile) |
| Generate a new filename with an incremented index based on a root name and delimiter. | |
| char * | MakeSCRDailyTimeGenerationFilename (char *rootname) |
| Generate a new daily filename with a timestamp based on the current date and time. | |
| char * | MakeDailyGenerationFilename (char *rootname, long digits, char *delimiter, long timetag) |
| Generate a new daily filename. Can include a time tag or a numeric index. | |
| char * | MakeMonthlyGenerationFilename (char *rootname, long digits, char *delimiter, long timetag) |
| Generate a new monthly filename. Can include a time tag or a numeric index. | |
| void | usleepSystemIndependent (long usec) |
| Sleep for a given number of microseconds, system-independently. | |
| char * | getHourMinuteSecond () |
| Get the current hour, minute, and second as a string. | |
| void | checkGenerationFileLocks (char *match_date) |
| Check for matching date-based generation files and ensure none are locked. | |
| void | TouchFile (char *filename) |
| Update the modification timestamp of a file if it exists. | |
| void checkGenerationFileLocks | ( | char * | match_date | ) |
Check for matching date-based generation files and ensure none are locked.
| match_date | Date pattern to match. |
Definition at line 648 of file logfile_gener.c.
| double computeYearStartTime | ( | double | StartTime | ) |
Compute the start time of the year for the given time.
| StartTime | Time in seconds since the Epoch. |
Definition at line 202 of file logfile_gener.c.
| char * getHourMinuteSecond | ( | ) |
Get the current hour, minute, and second as a string.
Definition at line 626 of file logfile_gener.c.
| double getHourOfDay | ( | ) |
Get the current hour of the day (0-23, possibly fractional).
Definition at line 113 of file logfile_gener.c.
| long double getLongDoubleTimeInSecs | ( | ) |
Get the current time in seconds since the Epoch as a long double for higher precision.
Definition at line 297 of file logfile_gener.c.
| void getTimeBreakdown | ( | double * | ptrTime, |
| double * | ptrDay, | ||
| double * | ptrHour, | ||
| double * | ptrJulianDay, | ||
| double * | ptrMonth, | ||
| double * | ptrYear, | ||
| char ** | ptrTimeStamp ) |
Retrieve detailed time breakdown (day, hour, julian day, month, year, and timestamp).
| ptrTime | If not NULL, stores the time in seconds since the Epoch. |
| ptrDay | If not NULL, stores the day of the month (fractional). |
| ptrHour | If not NULL, stores the hour of the day (fractional). |
| ptrJulianDay | If not NULL, stores the Julian day (fractional). |
| ptrMonth | If not NULL, stores the month of the year (fractional). |
| ptrYear | If not NULL, stores the year (fractional). |
| ptrTimeStamp | If not NULL, stores a pointer to a timestamp string. |
Definition at line 100 of file logfile_gener.c.
| double getTimeInSecs | ( | ) |
Get the current time in seconds since the Epoch with high resolution.
Definition at line 271 of file logfile_gener.c.
| char * MakeDailyGenerationFilename | ( | char * | rootname, |
| long | digits, | ||
| char * | delimiter, | ||
| long | timetag ) |
Generate a new daily filename. Can include a time tag or a numeric index.
| rootname | Base name for the file. |
| digits | Number of digits for the index. |
| delimiter | Delimiter between parts of the filename. |
| timetag | If non-zero, includes a time tag in the filename. |
Definition at line 429 of file logfile_gener.c.
| char * MakeGenerationFilename | ( | char * | rootname, |
| long | digits, | ||
| char * | delimiter, | ||
| char * | lastFile ) |
Generate a new filename with an incremented index based on a root name and delimiter.
| rootname | Base name for the file. |
| digits | Number of digits to use for the index. |
| delimiter | Delimiter between root name and index. |
| lastFile | Last generated filename, used to determine the next index. |
Definition at line 327 of file logfile_gener.c.
| char * MakeMonthlyGenerationFilename | ( | char * | rootname, |
| long | digits, | ||
| char * | delimiter, | ||
| long | timetag ) |
Generate a new monthly filename. Can include a time tag or a numeric index.
| rootname | Base name for the file. |
| digits | Number of digits for the index. |
| delimiter | Delimiter between parts of the filename. |
| timetag | If non-zero, includes a time tag in the filename. |
Definition at line 524 of file logfile_gener.c.
| char * MakeSCRDailyTimeGenerationFilename | ( | char * | rootname | ) |
Generate a new daily filename with a timestamp based on the current date and time.
| rootname | Base name for the file. |
Definition at line 393 of file logfile_gener.c.
| void makeTimeBreakdown | ( | double | Time, |
| double * | ptrTime, | ||
| double * | ptrDay, | ||
| double * | ptrHour, | ||
| double * | ptrJulianDay, | ||
| double * | ptrMonth, | ||
| double * | ptrYear, | ||
| char ** | ptrTimeStamp ) |
Break down a given time into multiple components (time, day, hour, Julian day, month, year, and timestamp).
| Time | Time in seconds since the Epoch. |
| ptrTime | If not NULL, stores the input time value. |
| ptrDay | If not NULL, stores the day of the month (fractional). |
| ptrHour | If not NULL, stores the hour of the day (fractional). |
| ptrJulianDay | If not NULL, stores the Julian day (fractional). |
| ptrMonth | If not NULL, stores the month (fractional). |
| ptrYear | If not NULL, stores the year (fractional). |
| ptrTimeStamp | If not NULL, stores a timestamp string. |
Definition at line 146 of file logfile_gener.c.
| char * makeTimeStamp | ( | double | Time | ) |
Create a human-readable timestamp from the given time in seconds since the Epoch.
| Time | Time in seconds since the Epoch. |
Definition at line 81 of file logfile_gener.c.
| void TouchFile | ( | char * | filename | ) |
Update the modification timestamp of a file if it exists.
| filename | File to "touch." |
Definition at line 683 of file logfile_gener.c.
| void usleepSystemIndependent | ( | long | usec | ) |
Sleep for a given number of microseconds, system-independently.
| usec | Number of microseconds to sleep. |
Definition at line 611 of file logfile_gener.c.