MCPcopy Create free account
hub / github.com/NetHack/NetHack / do_date

Function do_date

util/makedefs.c:1717–1905  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1715
1716#if defined(OLD_MAKEDEFS_OPTIONS)
1717void
1718do_date(void)
1719{
1720#ifdef KR1ED
1721 long clocktim = 0;
1722#else
1723 time_t clocktim = 0;
1724#endif
1725 char githash[BUFSZ], gitbranch[BUFSZ];
1726 char *c, cbuf[60], buf[BUFSZ];
1727 const char *ul_sfx;
1728#if defined(CROSSCOMPILE) && !defined(CROSSCOMPILE_TARGET)
1729 const char *xpref = "HOST_";
1730#else
1731 const char *xpref = (const char *) 0;
1732#endif /* CROSSCOMPILE && !CROSSCOMPILE_TARGET */
1733
1734 /* before creating date.h, make sure that xxx_GRAPHICS and
1735 DEFAULT_WINDOW_SYS have been set up in a viable fashion */
1736 windowing_sanity();
1737
1738 filename[0] = '\0';
1739#ifdef FILE_PREFIX
1740 Strcat(filename, file_prefix);
1741#endif
1742 Sprintf(eos(filename), INCLUDE_TEMPLATE, DATE_FILE);
1743 if (!(ofp = fopen(filename, WRTMODE))) {
1744 perror(filename);
1745 makedefs_exit(EXIT_FAILURE);
1746 /*NOTREACHED*/
1747 }
1748 /* NB: We've moved on from SCCS, but this way this line
1749 * won't get clobbered when downstream projects import
1750 * this file into something more modern. */
1751 Fprintf(ofp, "%s", Reference_file);
1752
1753 (void) time(&clocktim);
1754#ifdef REPRODUCIBLE_BUILD
1755 {
1756 /*
1757 * Use date+time of latest source file revision (set up in
1758 * our environment rather than derived by scanning sources)
1759 * instead of current date+time, so that later rebuilds of
1760 * the same sources specifying the same configuration will
1761 * produce the same result.
1762 *
1763 * Changing the configuration should be done by modifying
1764 * config.h or <port>conf.h and setting SOURCE_DATE_EPOCH
1765 * based on whichever changed most recently, not by using
1766 * make CFLAGS='-Dthis -Dthat'
1767 * to make alterations on the fly.
1768 *
1769 * Limited validation is performed to prevent dates in the
1770 * future (beyond a leeway of 24 hours) or distant past.
1771 *
1772 * Assumes the value of time_t is in seconds, which is
1773 * fundamental for Unix and mandated by POSIX. For any ports
1774 * where that isn't true, leaving REPRODUCIBLE_BUILD disabled

Callers 1

do_makedefsFunction · 0.85

Calls 12

windowing_sanityFunction · 0.85
eosFunction · 0.85
makedefs_exitFunction · 0.85
timeFunction · 0.85
mktimeFunction · 0.85
fflushFunction · 0.85
localtimeFunction · 0.85
md_ignored_featuresFunction · 0.85
mdlib_version_stringFunction · 0.85
version_id_stringFunction · 0.85
bannerc_stringFunction · 0.85
get_gitinfoFunction · 0.85

Tested by

no test coverage detected