mirror of
https://github.com/Interlisp/maiko.git
synced 2026-01-14 15:36:34 +00:00
MDate: Make time_t, not long. (#206)
MDate, generated into `vdate.c` from `mkvdate.c`, was being stored as a `long` rather than a `time_t`. This led to some casts, but also a bit of platform #ifdef'd code. This makes that go away by storing it as the `time_t` value that it really is. Also, update some comments and minor nits.
This commit is contained in:
parent
19033bba89
commit
9ba7e78625
@ -106,7 +106,7 @@ LispPTR *fixp_value(LispPTR *ptr) {
|
||||
#define PAGES_IN_MBYTE 2048
|
||||
|
||||
void init_ifpage(int sysout_size) {
|
||||
extern long MDate;
|
||||
extern time_t MDate;
|
||||
extern int DisplayType;
|
||||
extern int Storage_expanded;
|
||||
int new_lastvmem;
|
||||
@ -174,8 +174,8 @@ are null terminated instead */
|
||||
}
|
||||
#endif /* DOS */
|
||||
|
||||
/* sec from Oct-13-87 12:00 It's My birthday(take) */
|
||||
/* MDate may be set by makefile(by mkvdate.c) */
|
||||
/* Days from Oct-13-87 12:00 It's Takeshi's birthday. */
|
||||
/* MDate may be set by vdate.c, generated by mkvdate.c. */
|
||||
InterfacePage->rversion = (MDate - 561150000) / (60 * 60 * 24);
|
||||
|
||||
/* For DisplayType ,I couldn't insert this line into init_display */
|
||||
|
||||
@ -260,7 +260,7 @@ int flushing = FALSE; /* see dbprint.h if set, all debug/trace printing will cal
|
||||
extern DspInterface currentdsp;
|
||||
#endif /* DOS || XWINDOW */
|
||||
|
||||
extern long MDate;
|
||||
extern time_t MDate;
|
||||
extern int nokbdflag;
|
||||
extern int nomouseflag;
|
||||
#ifdef DOS
|
||||
@ -736,11 +736,7 @@ void print_info_lines() {
|
||||
#elif (RELEASE == 351)
|
||||
printf("Emulator for Medley release 3.51\n");
|
||||
#endif /* RELEASE */
|
||||
#if defined(MACOSX) || defined(FREEBSD) || defined(LINUX)
|
||||
printf("Creation date: %s", ctime((const time_t *)&MDate));
|
||||
#else
|
||||
printf("Creation date: %s", ctime(&MDate));
|
||||
#endif
|
||||
#ifdef LPSOLVE
|
||||
printf("Contains lp_solve LP solver.\n");
|
||||
#endif /* LPSOLVE */
|
||||
|
||||
@ -19,8 +19,11 @@
|
||||
/* InterfacePage->rversion. The version number is the number */
|
||||
/* of whole days since 12:00 13-Oct-87 (Takeshi's birthday). */
|
||||
/* */
|
||||
/* This program prints a single line: */
|
||||
/* long MDate = <the version number> */
|
||||
/* This program prints a single line, with seconds since Unix */
|
||||
/* epoch, which is converted to days since Takeshi's birthday in */
|
||||
/* initsout.c: */
|
||||
/* */
|
||||
/* time_t MDate = <the version number> */
|
||||
/* */
|
||||
/* That output is redirected to create the file vdate.c, which */
|
||||
/* is then compiled as part of the emulator MAKE. */
|
||||
@ -39,7 +42,7 @@
|
||||
int main(void) {
|
||||
long dtime;
|
||||
time(&dtime);
|
||||
fprintf(stderr, "Mdate :%ld\n", dtime);
|
||||
fprintf(stderr, "MDate: %ld\n", dtime);
|
||||
printf("long MDate= %ld;\n", dtime);
|
||||
return (0);
|
||||
}
|
||||
@ -48,11 +51,17 @@ int main(void) {
|
||||
int main(void) {
|
||||
struct timeval time;
|
||||
|
||||
/* On some Unix platforms, time_t is an int and on
|
||||
* others, it is a long. We'll store it as a time_t,
|
||||
* but print it as a long so that we can avoid format
|
||||
* warnings about differing sized types.
|
||||
*/
|
||||
gettimeofday(&time, NULL);
|
||||
fprintf(stderr, "Mdate :%ld\n", (long)time.tv_sec);
|
||||
fprintf(stderr, "MDate: %ld\n", (long)time.tv_sec);
|
||||
fprintf(stderr, "Version: %s\n", ctime(&time.tv_sec));
|
||||
|
||||
printf("long MDate= %ld;\n", (long)time.tv_sec);
|
||||
printf("#include <time.h>\n");
|
||||
printf("time_t MDate= %ld;\n", (long)time.tv_sec);
|
||||
return (0);
|
||||
}
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user