mirror of
https://github.com/wolfcw/libfaketime.git
synced 2026-05-17 08:36:28 +03:00
Custom timestamp filename added: ~/.faketimerc alternative
This commit is contained in:
11
README
11
README
@@ -169,14 +169,15 @@ will be loaded, but just report the real system time. There are three
|
||||
ways to specify the faked time:
|
||||
|
||||
a) By setting the environment variable FAKETIME.
|
||||
b) By using the file .faketimerc in your home directory.
|
||||
c) By using the file /etc/faketimerc for a system-wide default.
|
||||
b) By using the file given in the environment variable FAKETIME_TIMESTAMP_FILE
|
||||
c) By using the file .faketimerc in your home directory.
|
||||
d) By using the file /etc/faketimerc for a system-wide default.
|
||||
|
||||
If you want to use b) or c), $HOME/.faketimerc or /etc/faketimerc consist of
|
||||
If you want to use b) c) or d), $HOME/.faketimerc or /etc/faketimerc consist of
|
||||
only one line of text with exactly the same content as the FAKETIME environment
|
||||
variable, which is described below. Note that /etc/faketimerc will only be used
|
||||
if there is no $HOME/.faketimerc, and the FAKETIME environment variable always
|
||||
has priority over the files.
|
||||
if there is no $HOME/.faketimerc nor FAKETIME_TIMESTAMP_FILE file exists, and
|
||||
the FAKETIME environment variable always has priority over the files.
|
||||
|
||||
|
||||
4b) Using absolute dates
|
||||
|
||||
@@ -1777,6 +1777,7 @@ int fake_clock_gettime(clockid_t clk_id, struct timespec *tp)
|
||||
if (parse_config_file)
|
||||
{
|
||||
static char user_faked_time[BUFFERLEN]; /* changed to static for caching in v0.6 */
|
||||
char custom_filename[BUFSIZ];
|
||||
char filename[BUFSIZ];
|
||||
FILE *faketimerc;
|
||||
/* initialize with default or env. variable */
|
||||
@@ -1794,8 +1795,10 @@ int fake_clock_gettime(clockid_t clk_id, struct timespec *tp)
|
||||
* a system-wide /etc/faketimerc present.
|
||||
* The /etc/faketimerc handling has been contributed by David Burley,
|
||||
* Jacob Moorman, and Wayne Davison of SourceForge, Inc. in version 0.6 */
|
||||
(void) snprintf(custom_filename, BUFSIZ, "%s", getenv("FAKETIME_TIMESTAMP_FILE"));
|
||||
(void) snprintf(filename, BUFSIZ, "%s/.faketimerc", getenv("HOME"));
|
||||
if ((faketimerc = fopen(filename, "rt")) != NULL ||
|
||||
if ((faketimerc = fopen(custom_filename, "rt")) != NULL ||
|
||||
(faketimerc = fopen(filename, "rt")) != NULL ||
|
||||
(faketimerc = fopen("/etc/faketimerc", "rt")) != NULL)
|
||||
{
|
||||
char line[BUFFERLEN];
|
||||
|
||||
Reference in New Issue
Block a user