Commit cd3fc2aa authored by Nick Mathewson's avatar Nick Mathewson 🦀
Browse files

Merge remote-tracking branch 'neel/b25511-r4'

parents 8c01aee2 dca36eff
Loading
Loading
Loading
Loading

changes/ticket25511

0 → 100644
+5 −0
Original line number Diff line number Diff line
  o Minor features (control port):
    - Introduce GETINFO "current-time/{local,utc}" to return the local
      and UTC times respectively in ISO format. This helps a controller
      like Tor Browser detect a time-related error. Closes ticket 25511.
      Patch by Neel Chauhan.
+2 −2
Original line number Diff line number Diff line
@@ -71,8 +71,8 @@ tor_sleep_msec(int msec)
/** Set *timeval to the current time of day.  On error, log and terminate.
 * (Same as gettimeofday(timeval,NULL), but never returns -1.)
 */
void
tor_gettimeofday(struct timeval *timeval)
MOCK_IMPL(void,
tor_gettimeofday, (struct timeval *timeval))
{
#ifdef _WIN32
  /* Epoch bias copied from perl: number of units between windows epoch and
+1 −1
Original line number Diff line number Diff line
@@ -173,7 +173,7 @@ void monotime_coarse_add_msec(monotime_coarse_t *out,
#define monotime_coarse_add_msec monotime_add_msec
#endif /* defined(MONOTIME_COARSE_TYPE_IS_DIFFERENT) */

void tor_gettimeofday(struct timeval *timeval);
MOCK_DECL(void, tor_gettimeofday, (struct timeval *timeval));

#ifdef TOR_UNIT_TESTS
void tor_sleep_msec(int msec);
+9 −0
Original line number Diff line number Diff line
@@ -1834,6 +1834,15 @@ format_iso_time(char *buf, time_t t)
  strftime(buf, ISO_TIME_LEN+1, "%Y-%m-%d %H:%M:%S", tor_gmtime_r(&t, &tm));
}

/** As format_local_iso_time, but use the yyyy-mm-ddThh:mm:ss format to avoid
 * embedding an internal space. */
void
format_local_iso_time_nospace(char *buf, time_t t)
{
  format_local_iso_time(buf, t);
  buf[10] = 'T';
}

/** As format_iso_time, but use the yyyy-mm-ddThh:mm:ss format to avoid
 * embedding an internal space. */
void
+1 −0
Original line number Diff line number Diff line
@@ -271,6 +271,7 @@ int parse_rfc1123_time(const char *buf, time_t *t);
#define ISO_TIME_USEC_LEN (ISO_TIME_LEN+7)
void format_local_iso_time(char *buf, time_t t);
void format_iso_time(char *buf, time_t t);
void format_local_iso_time_nospace(char *buf, time_t t);
void format_iso_time_nospace(char *buf, time_t t);
void format_iso_time_nospace_usec(char *buf, const struct timeval *tv);
int parse_iso_time_(const char *cp, time_t *t, int strict, int nospace);
Loading