Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(584)

Delta Between Two Patch Sets: src/pkg/runtime/time.goc

Issue 5392041: code review 5392041: time: new Time, Duration, ZoneInfo types (Closed)
Left Patch Set: Created 13 years, 4 months ago
Right Patch Set: diff -r 3c286b9b2206 https://go.googlecode.com/hg/ Created 13 years, 3 months ago
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments. Please Sign in to add in-line comments.
Jump to:
Right: Side by side diff | Download
« no previous file with change/comment | « src/pkg/runtime/openbsd/amd64/sys.s ('k') | src/pkg/runtime/windows/thread.c » ('j') | no next file with change/comment »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
LEFTRIGHT
(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 // Time-related runtime and pieces of package time. 5 // Time-related runtime and pieces of package time.
6 6
7 package time 7 package time
8 8
9 #include "runtime.h" 9 #include "runtime.h"
10 #include "defs.h" 10 #include "defs.h"
11 #include "os.h" 11 #include "os.h"
12 #include "arch.h" 12 #include "arch.h"
13 #include "malloc.h" 13 #include "malloc.h"
14 14
15 static Timers timers; 15 static Timers timers;
16 static void addtimer(Timer*); 16 static void addtimer(Timer*);
17 static bool deltimer(Timer*); 17 static bool deltimer(Timer*);
18 18
19 // Package time APIs. 19 // Package time APIs.
20 // Godoc uses the comments in package time, not these. 20 // Godoc uses the comments in package time, not these.
21 21
22 // Nanoseconds returns the current time in nanoseconds. 22 // time.now is implemented in assembly.
23 func Nanoseconds() (ret int64) {
24 » ret = runtime·nanotime();
25 }
26 23
27 // Sleep puts the current goroutine to sleep for at least ns nanoseconds. 24 // Sleep puts the current goroutine to sleep for at least ns nanoseconds.
28 func Sleep(ns int64) { 25 func Sleep(ns int64) {
29 g->status = Gwaiting; 26 g->status = Gwaiting;
30 g->waitreason = "sleep"; 27 g->waitreason = "sleep";
31 runtime·tsleep(ns); 28 runtime·tsleep(ns);
32 } 29 }
33 30
34 // startTimer adds t to the timer heap. 31 // startTimer adds t to the timer heap.
35 func startTimer(t *Timer) { 32 func startTimer(t *Timer) {
(...skipping 211 matching lines...) Expand 10 before | Expand all | Expand 10 after
247 if(t[c]->when >= t[i]->when) 244 if(t[c]->when >= t[i]->when)
248 break; 245 break;
249 tmp = t[i]; 246 tmp = t[i];
250 t[i] = t[c]; 247 t[i] = t[c];
251 t[c] = tmp; 248 t[c] = tmp;
252 t[i]->i = i; 249 t[i]->i = i;
253 t[c]->i = c; 250 t[c]->i = c;
254 i = c; 251 i = c;
255 } 252 }
256 } 253 }
LEFTRIGHT

Powered by Google App Engine
RSS Feeds Recent Issues | This issue
This is Rietveld f62528b