* Update configure script according to previous change to configure.ac
[alpine.git] / pith / adjtime.c
blobdfd56cc7bf3933b0ad47aa21ef42f64aa37caa51
1 /*
2 * ========================================================================
3 * Copyright 2013-2022 Eduardo Chappa
4 * Copyright 2006 University of Washington
6 * Licensed under the Apache License, Version 2.0 (the "License");
7 * you may not use this file except in compliance with the License.
8 * You may obtain a copy of the License at
10 * http://www.apache.org/licenses/LICENSE-2.0
12 * ========================================================================
15 #include "../pith/headers.h"
16 #include "../pith/adjtime.h"
20 * MSC ver 7.0 and less times are since 1900, everybody else's time so far
21 * is since 1970. sheesh.
23 #if defined(DOS) && (_MSC_VER == 700)
24 #define EPOCH_ADJ ((time_t)((time_t)(70*365 + 18) * (time_t)86400))
25 #endif
28 * Adjust the mtime to return time since Unix epoch. DOS is off by 70 years.
30 time_t
31 get_adj_time(void)
33 time_t tt;
35 tt = time((time_t *)0);
37 #ifdef EPOCH_ADJ
38 tt -= EPOCH_ADJ;
39 #endif
41 return(tt);
45 time_t
46 get_adj_name_file_mtime(char *name)
48 time_t mtime;
50 mtime = name_file_mtime(name);
52 #ifdef EPOCH_ADJ
53 if(mtime != (time_t)(-1))
54 mtime -= EPOCH_ADJ;
55 #endif
57 return(mtime);