mirror of
https://gitlab.torproject.org/tpo/core/tor.git
synced 2025-02-26 23:52:30 +01:00
27 lines
600 B
C
27 lines
600 B
C
|
/* Copyright (c) 2014, The Tor Project, Inc. */
|
||
|
/* See LICENSE for licensing information */
|
||
|
|
||
|
/**
|
||
|
* \file test_helpers.c
|
||
|
* \brief Some helper functions to avoid code duplication in unit tests.
|
||
|
*/
|
||
|
|
||
|
#include "orconfig.h"
|
||
|
#include "or.h"
|
||
|
|
||
|
#include "test_helpers.h"
|
||
|
|
||
|
/* Return a statically allocated string representing yesterday's date
|
||
|
* in ISO format. We use it so that state file items are not found to
|
||
|
* be outdated. */
|
||
|
const char *
|
||
|
get_yesterday_date_str(void)
|
||
|
{
|
||
|
static char buf[ISO_TIME_LEN+1];
|
||
|
|
||
|
time_t yesterday = time(NULL) - 24*60*60;
|
||
|
format_iso_time(buf, yesterday);
|
||
|
return buf;
|
||
|
}
|
||
|
|