Changeset 2032
- Timestamp:
- Jun 14, 2005, 4:59:56 AM (20 years ago)
- Location:
- trunk/src/emx
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/emx/ChangeLog.LIBC
-
Property cvs2svn:cvs-rev
changed from
1.57
to1.58
r2031 r2032 12 12 (included by sys/param.h which is used by lot's of tcpip headers). 13 13 Define _BSD_NAMESPACE_POLLUTION to get it all. 14 o Fixed bug in getitimer/setitmer, it didn't zero the old value struct 15 if the timer wasn't running. 16 o Fixed a bug in __ftime(), the time was jolting around. 14 17 15 18 2005-06-12: knut st. osmundsen <bird-gccos2-spam@anduin.net> -
Property cvs2svn:cvs-rev
changed from
-
trunk/src/emx/src/lib/sys/__ftime.c
-
Property cvs2svn:cvs-rev
changed from
1.7
to1.8
r2031 r2032 12 12 * 13 13 */ 14 15 #define CALCDIFF 14 16 15 17 … … 29 31 #include "syscalls.h" 30 32 33 #ifdef CALCDIFF 31 34 /** 32 35 * Calcs the uDiff in formula timeb.millitm = (msecs + uDiff) % 1000. … … 89 92 return uDiff; 90 93 } 94 #endif /* CALCDIFF */ 91 95 92 96 … … 99 103 void __ftime(struct timeb *ptr) 100 104 { 105 #pragma pack(1) 106 union last 107 { 108 unsigned long long ull; 109 struct 110 { 111 unsigned secs; 112 unsigned msecs; 113 short milli; 114 } s; 115 }; 101 116 union combined 102 117 { 103 volatile unsigned long long ull;104 118 struct 105 119 { 106 120 ULONG time; 107 121 ULONG msecs; 122 UCHAR hour; 123 UCHAR minutes; 124 UCHAR seconds; 125 UCHAR hundredths; 108 126 } s; 109 127 }; … … 111 129 { 112 130 PGINFOSEG pGIS; 113 union combined *pCombined;131 volatile union combined *pCombined; 114 132 } uGIS; 115 static unsigned uDiff; 116 union combined Combined; 133 #pragma pack() 134 static volatile union last LastStatic; 135 static volatile unsigned uDiff; 117 136 118 137 /* … … 121 140 if (!uGIS.pGIS) 122 141 { 142 #ifdef CALCDIFF 123 143 uDiff = calcdiff(); 144 #endif 124 145 uGIS.pGIS = GETGINFOSEG(); 125 146 } … … 128 149 * Get the value and convert it to the return format. 129 150 */ 130 Combined = *uGIS.pCombined; 131 ptr->time = Combined.s.time; 132 ptr->millitm = (Combined.s.msecs + uDiff) % 1000; 151 /* read times */ 152 union combined Combined = *uGIS.pCombined; 153 union last LastCopy = LastStatic; 154 155 /* calc now */ 156 union last Now; 157 Now.s.secs = Combined.s.seconds; 158 #ifdef CALCDIFF 159 Now.s.milli = (Combined.s.msecs + uDiff) % 1000; 160 #else 161 Now.s.milli = (Combined.s.hundredths * 10) | ((Combined.s.msecs + uDiff) % 10); 162 #endif 163 Now.s.msecs = Combined.s.msecs; 164 165 /* validate now */ 166 unsigned uDiffSecs = Now.s.secs - LastCopy.s.secs; 167 if (!uDiffSecs) 168 { 169 int iDiffMilli = Now.s.milli - LastCopy.s.milli; 170 if (iDiffMilli < 0) 171 { 172 uDiff -= -iDiffMilli + 1; 173 Now = LastCopy; 174 } 175 } 176 else if (uDiffSecs == 1) 177 { 178 unsigned uDiffMsecs = Now.s.msecs - LastCopy.s.msecs; 179 unsigned uDiffMilli = Now.s.milli + 1000 - LastCopy.s.milli; 180 if (uDiffMilli > uDiffMsecs + 500) 181 { 182 uDiff += 1000 - Now.s.milli; 183 Now.s.milli = 0; 184 } 185 } 186 187 /* update the last know ok value */ 188 LastStatic = Now; /** @todo 8byte + 4 byte exchange! */ 189 190 /* store the result in the user buffer */ 191 ptr->time = Now.s.secs; 192 ptr->millitm = Now.s.milli; 133 193 ptr->timezone = 0; 134 194 ptr->dstflag = 0; -
Property cvs2svn:cvs-rev
changed from
-
trunk/src/emx/src/lib/sys/b_signalTimer.c
-
Property cvs2svn:cvs-rev
changed from
1.4
to1.5
r2031 r2032 399 399 * This is *not* gonna be very accurate! 400 400 */ 401 if (pOldValue && gfArmed) 402 { 403 OldValue.it_interval.tv_sec = guInterval / 1000; 404 OldValue.it_interval.tv_usec = (guInterval % 1000) * 1000; 405 406 unsigned u = guNext; 407 u -= signalTimerClock(); 408 if (u <= guInterval) 409 { 410 OldValue.it_value.tv_sec = u / 1000; 411 OldValue.it_value.tv_usec = (u % 1000) * 1000; 412 } 401 if (pOldValue) 402 { 403 if (gfArmed) 404 { 405 OldValue.it_interval.tv_sec = guInterval / 1000; 406 OldValue.it_interval.tv_usec = (guInterval % 1000) * 1000; 407 408 unsigned u = guNext; 409 u -= signalTimerClock(); 410 if (u <= guInterval) 411 { 412 OldValue.it_value.tv_sec = u / 1000; 413 OldValue.it_value.tv_usec = (u % 1000) * 1000; 414 } 415 } 416 else 417 memset(pOldValue, 0, sizeof(*pOldValue)); 413 418 } 414 419 -
Property cvs2svn:cvs-rev
changed from
Note:
See TracChangeset
for help on using the changeset viewer.