LEFT | RIGHT |
(no file at all) | |
1 // Copyright 2009 The Go Authors. All rights reserved. | 1 // Copyright 2009 The Go Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style | 2 // Use of this source code is governed by a BSD-style |
3 // license that can be found in the LICENSE file. | 3 // license that can be found in the LICENSE file. |
4 | 4 |
5 #include "runtime.h" | 5 #include "runtime.h" |
6 #include "type.h" | 6 #include "type.h" |
7 #include "defs.h" | 7 #include "defs.h" |
8 #include "os.h" | 8 #include "os.h" |
9 | 9 |
10 #pragma dynimport runtime·CloseHandle CloseHandle "kernel32.dll" | 10 #pragma dynimport runtime·CloseHandle CloseHandle "kernel32.dll" |
(...skipping 201 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
212 { | 212 { |
213 int64 filetime; | 213 int64 filetime; |
214 | 214 |
215 runtime·stdcall(runtime·GetSystemTimeAsFileTime, 1, &filetime); | 215 runtime·stdcall(runtime·GetSystemTimeAsFileTime, 1, &filetime); |
216 | 216 |
217 // Filetime is 100s of nanoseconds since January 1, 1601. | 217 // Filetime is 100s of nanoseconds since January 1, 1601. |
218 // Convert to nanoseconds since January 1, 1970. | 218 // Convert to nanoseconds since January 1, 1970. |
219 return (filetime - 116444736000000000LL) * 100LL; | 219 return (filetime - 116444736000000000LL) * 100LL; |
220 } | 220 } |
221 | 221 |
| 222 void |
| 223 time·now(int64 sec, int32 usec) |
| 224 { |
| 225 int64 ns; |
| 226 ········ |
| 227 ns = runtime·nanotime(); |
| 228 sec = ns / 1000000000LL; |
| 229 usec = ns - sec * 1000000000LL; |
| 230 FLUSH(&sec); |
| 231 FLUSH(&usec); |
| 232 } |
| 233 |
222 // Calling stdcall on os stack. | 234 // Calling stdcall on os stack. |
223 #pragma textflag 7 | 235 #pragma textflag 7 |
224 void * | 236 void * |
225 runtime·stdcall(void *fn, int32 count, ...) | 237 runtime·stdcall(void *fn, int32 count, ...) |
226 { | 238 { |
227 WinCall c; | 239 WinCall c; |
228 | 240 |
229 c.fn = fn; | 241 c.fn = fn; |
230 c.n = count; | 242 c.n = count; |
231 c.args = (uintptr*)&count + 1; | 243 c.args = (uintptr*)&count + 1; |
(...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
389 runtime·stdcall(runtime·SetWaitableTimer, 6, | 401 runtime·stdcall(runtime·SetWaitableTimer, 6, |
390 profiletimer, &due, (uintptr)ms, nil, nil, nil); | 402 profiletimer, &due, (uintptr)ms, nil, nil, nil); |
391 runtime·atomicstore((uint32*)&m->profilehz, hz); | 403 runtime·atomicstore((uint32*)&m->profilehz, hz); |
392 } | 404 } |
393 | 405 |
394 void | 406 void |
395 os·sigpipe(void) | 407 os·sigpipe(void) |
396 { | 408 { |
397 runtime·throw("too many writes on closed pipe"); | 409 runtime·throw("too many writes on closed pipe"); |
398 } | 410 } |
LEFT | RIGHT |