git/date.c

/*
 * GIT - The information manager from hell
 *
 * Copyright (C) Linus Torvalds, 2005
 */

#include "git-compat-util.h"
#include "date.h"
#include "gettext.h"
#include "pager.h"
#include "strbuf.h"

/*
 * This is like mktime, but without normalization of tm_wday and tm_yday.
 */
time_t tm_to_time_t(const struct tm *tm)
{}

static const char *month_names[] =;

static const char *weekday_names[] =;

static time_t gm_time_t(timestamp_t time, int tz)
{}

/*
 * The "tz" thing is passed in as this strange "decimal parse of tz"
 * thing, which means that tz -0100 is passed in as the integer -100,
 * even though it means "sixty minutes off"
 */
static struct tm *time_to_tm(timestamp_t time, int tz, struct tm *tm)
{}

static struct tm *time_to_tm_local(timestamp_t time, struct tm *tm)
{}

/*
 * Fill in the localtime 'struct tm' for the supplied time,
 * and return the local tz.
 */
static int local_time_tzoffset(time_t t, struct tm *tm)
{}

/*
 * What value of "tz" was in effect back then at "time" in the
 * local timezone?
 */
static int local_tzoffset(timestamp_t time)
{}

static void get_time(struct timeval *now)
{}

void show_date_relative(timestamp_t time, struct strbuf *timebuf)
{}

struct date_mode date_mode_from_type(enum date_mode_type type)
{}

static void show_date_normal(struct strbuf *buf, timestamp_t time, struct tm *tm, int tz, struct tm *human_tm, int human_tz, int local)
{}

const char *show_date(timestamp_t time, int tz, struct date_mode mode)
{}

/*
 * Check these. And note how it doesn't do the summer-time conversion.
 *
 * In my world, it's always summer, and things are probably a bit off
 * in other ways too.
 */
static const struct {} timezone_names[] =;

static int match_string(const char *date, const char *str)
{}

static int skip_alpha(const char *date)
{}

/*
* Parse month, weekday, or timezone name
*/
static int match_alpha(const char *date, struct tm *tm, int *offset)
{}

static int set_date(int year, int month, int day, struct tm *now_tm, time_t now, struct tm *tm)
{}

static int set_time(long hour, long minute, long second, struct tm *tm)
{}

static int is_date_known(struct tm *tm)
{}

static int match_multi_number(timestamp_t num, char c, const char *date,
			      char *end, struct tm *tm, time_t now)
{}

/*
 * Have we filled in any part of the time/date yet?
 * We just do a binary 'and' to see if the sign bit
 * is set in all the values.
 */
static inline int nodate(struct tm *tm)
{}

/*
 * Have we seen an ISO-8601-alike date, i.e. 20220101T0,
 * In which, hour is still unset,
 * and minutes and second has been set to 0.
 */
static inline int maybeiso8601(struct tm *tm)
{}

/*
 * We've seen a digit. Time? Year? Date?
 */
static int match_digit(const char *date, struct tm *tm, int *offset, int *tm_gmt)
{}

static int match_tz(const char *date, int *offp)
{}

static void date_string(timestamp_t date, int offset, struct strbuf *buf)
{}

/*
 * Parse a string like "0 +0000" as ancient timestamp near epoch, but
 * only when it appears not as part of any other string.
 */
static int match_object_header_date(const char *date, timestamp_t *timestamp, int *offset)
{}


/* timestamp of 2099-12-31T23:59:59Z, including 32 leap days */
static const timestamp_t timestamp_max =;

/* Gr. strptime is crap for this; it doesn't have a way to require RFC2822
   (i.e. English) day/month names, and it doesn't work correctly with %z. */
int parse_date_basic(const char *date, timestamp_t *timestamp, int *offset)
{}

int parse_expiry_date(const char *date, timestamp_t *timestamp)
{}

int parse_date(const char *date, struct strbuf *result)
{}

static enum date_mode_type parse_date_type(const char *format, const char **end)
{}

void parse_date_format(const char *format, struct date_mode *mode)
{}

void date_mode_release(struct date_mode *mode)
{}

void datestamp(struct strbuf *out)
{}

/*
 * Relative time update (eg "2 days ago").  If we haven't set the time
 * yet, we need to set it from current time.
 */
static time_t update_tm(struct tm *tm, struct tm *now, time_t sec)
{}

/*
 * Do we have a pending number at the end, or when
 * we see a new one? Let's assume it's a month day,
 * as in "Dec 6, 1992"
 */
static void pending_number(struct tm *tm, int *num)
{}

static void date_now(struct tm *tm, struct tm *now, int *num)
{}

static void date_yesterday(struct tm *tm, struct tm *now, int *num)
{}

static void date_time(struct tm *tm, struct tm *now, int hour)
{}

static void date_midnight(struct tm *tm, struct tm *now, int *num)
{}

static void date_noon(struct tm *tm, struct tm *now, int *num)
{}

static void date_tea(struct tm *tm, struct tm *now, int *num)
{}

static void date_pm(struct tm *tm, struct tm *now UNUSED, int *num)
{}

static void date_am(struct tm *tm, struct tm *now UNUSED, int *num)
{}

static void date_never(struct tm *tm, struct tm *now UNUSED, int *num)
{}

static const struct special {} special[] =;

static const char *number_name[] =;

static const struct typelen {} typelen[] =;

static const char *approxidate_alpha(const char *date, struct tm *tm, struct tm *now, int *num, int *touched)
{}

static const char *approxidate_digit(const char *date, struct tm *tm, int *num,
				     time_t now)
{}

static timestamp_t approxidate_str(const char *date,
				   const struct timeval *tv,
				   int *error_ret)
{}

timestamp_t approxidate_careful(const char *date, int *error_ret)
{}

int date_overflows(timestamp_t t)
{}