* Create help for explaining how encrypted password file support
[alpine.git] / pith / adjtime.c
blobbc125d35bf792b3e6c215d1e23464352ae6d93d4
1 #if !defined(lint) && !defined(DOS)
2 static char rcsid[] = "$Id: adjtime.c 761 2007-10-23 22:35:18Z hubert@u.washington.edu $";
3 #endif
5 /*
6 * ========================================================================
7 * Copyright 2006 University of Washington
9 * Licensed under the Apache License, Version 2.0 (the "License");
10 * you may not use this file except in compliance with the License.
11 * You may obtain a copy of the License at
13 * http://www.apache.org/licenses/LICENSE-2.0
15 * ========================================================================
18 #include "../pith/headers.h"
19 #include "../pith/adjtime.h"
23 * MSC ver 7.0 and less times are since 1900, everybody else's time so far
24 * is since 1970. sheesh.
26 #if defined(DOS) && (_MSC_VER == 700)
27 #define EPOCH_ADJ ((time_t)((time_t)(70*365 + 18) * (time_t)86400))
28 #endif
31 * Adjust the mtime to return time since Unix epoch. DOS is off by 70 years.
33 time_t
34 get_adj_time(void)
36 time_t tt;
38 tt = time((time_t *)0);
40 #ifdef EPOCH_ADJ
41 tt -= EPOCH_ADJ;
42 #endif
44 return(tt);
48 time_t
49 get_adj_name_file_mtime(char *name)
51 time_t mtime;
53 mtime = name_file_mtime(name);
55 #ifdef EPOCH_ADJ
56 if(mtime != (time_t)(-1))
57 mtime -= EPOCH_ADJ;
58 #endif
60 return(mtime);