Text file
src/runtime/time_windows_amd64.s
1 // Copyright 2011 The Go Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style
3 // license that can be found in the LICENSE file.
4
5 //go:build !faketime
6
7 #include "go_asm.h"
8 #include "textflag.h"
9 #include "time_windows.h"
10
11 TEXT time·now(SB),NOSPLIT,$0-24
12 CMPB runtime·useQPCTime(SB), $0
13 JNE useQPC
14
15 MOVQ $_INTERRUPT_TIME, DI
16 MOVQ time_lo(DI), AX
17 IMULQ $100, AX
18 MOVQ AX, mono+16(FP)
19
20 MOVQ $_SYSTEM_TIME, DI
21 MOVQ time_lo(DI), AX
22 MOVQ $116444736000000000, DI
23 SUBQ DI, AX
24 IMULQ $100, AX
25
26 // generated code for
27 // func f(x uint64) (uint64, uint64) { return x/1000000000, x%1000000000 }
28 // adapted to reduce duplication
29 MOVQ AX, CX
30 MOVQ $1360296554856532783, AX
31 MULQ CX
32 ADDQ CX, DX
33 RCRQ $1, DX
34 SHRQ $29, DX
35 MOVQ DX, sec+0(FP)
36 IMULQ $1000000000, DX
37 SUBQ DX, CX
38 MOVL CX, nsec+8(FP)
39 RET
40 useQPC:
41 JMP runtime·nowQPC(SB)
42 RET
43
View as plain text