Changeset 1260 for trunk/tigcc/ld-tigcc/main.c
- Timestamp:
- 08/07/08 03:10:26 (4 years ago)
- File:
-
- 1 edited
-
trunk/tigcc/ld-tigcc/main.c (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/tigcc/ld-tigcc/main.c
r1171 r1260 40 40 #include <string.h> 41 41 #include <ctype.h> 42 #include <time.h> 42 43 43 44 #define RESULT_OK 0 … … 122 123 } 123 124 125 // Fill internal structures with time information 126 static void ComputeTimeInformation(PROGRAM *Program) 127 { 128 // Get the timestamp. 129 if (time(&Program->LinkTime.LinkTime) != (time_t)-1) 130 { 131 struct tm * broken_down_time; 132 133 broken_down_time = gmtime(&Program->LinkTime.LinkTime); 134 if (broken_down_time != NULL) { 135 // gmtime returns the number of years since 1900. 136 Program->LinkTime.year = broken_down_time->tm_year + 1900; 137 // gmtime returns the month between 0 and 11. 138 Program->LinkTime.month = broken_down_time->tm_mon + 1; 139 Program->LinkTime.day = broken_down_time->tm_mday; 140 // Convert from "seconds since Jan 1, 1970" to "seconds since Jan 1, 1997". 141 // 197x: 8x365 days, 2x366 days (leap years: 1972, 1976) => 315532800 seconds 142 // 198x: 7x365 days, 3x366 days (leap years: 1980, 1984, 1988) => 315619200 seconds 143 // 199x: 5x365 days, 2x366 days (leap years: 1992, 1996) => 220924800 seconds 144 // Total: 852076800 seconds. 145 Program->LinkTime.LinkTime -= (time_t)852076800L; 146 return; 147 } 148 } 149 150 // Failed, so set dummy values. 151 Warning (NULL, "Couldn't get current time, setting dummy values."); 152 Program->LinkTime.LinkTime = (time_t)0, 153 Program->LinkTime.year = 1997, 154 Program->LinkTime.month = 1, 155 Program->LinkTime.day = 1; 156 } 157 124 158 int main (int ArgCount, const char **Args) 125 159 { … … 170 204 // Initialize. 171 205 memset (&Program, 0, sizeof (Program)); 206 207 ComputeTimeInformation(&Program); 208 172 209 Program.EntryPoint.SymbolName = "__entry_point"; 173 210 #ifdef TARGET_EMBEDDED
Note: See TracChangeset
for help on using the changeset viewer.
