1
0
mirror of https://github.com/golang/go synced 2024-10-04 11:11:21 -06:00
Commit Graph

207 Commits

Author SHA1 Message Date
Bobby Powers
c9529e02c1 time: in Format give buffer an initial capacity
I have a small web server that simply sets several cookies
along with an expires header, and then returns.  In the
cpuprofile for a 200k request benchmark, time.Time.Format()
was showing up as 8.3% of cpu usage.  Giving the buffer an
inital capacity to avoid reallocs on append drops it down to
7.6%.

R=golang-dev, r
CC=golang-dev
https://golang.org/cl/5992058
2012-04-07 10:51:32 +10:00
Rob Pike
7a33265ccd time.RFC822: make the string standard-compliant
For mysterious reasons, the existing string was just wrong: it was missing a colon.
There is no apparent reason for this discrepancy.

This should be safe to fix because existing uses would not be RFC822-compliant;
people cannot be depending on it to generate correct mail headers.

Fixes #3444.

R=golang-dev, dsymonds, iant, rsc
CC=golang-dev
https://golang.org/cl/5969072
2012-04-04 06:54:39 +10:00
Alex Brainman
d3c92b7c90 time: fix handling of locations with no dst on windows
Fixes #3437.

R=rsc
CC=golang-dev
https://golang.org/cl/5967063
2012-04-03 11:39:38 +10:00
Russ Cox
2ee538bc27 time: mention receiver in Unix, UnixNano docs
Fixes #3248.

R=golang-dev, dsymonds
CC=golang-dev
https://golang.org/cl/5784052
2012-03-08 08:32:52 -05:00
Russ Cox
babbf941c9 net, net/rpc, reflect, time: document concurrency guarantees
Fixes #1599.

R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/5777043
2012-03-07 14:55:09 -05:00
Shenghou Ma
db80edde7d time: during short test, do not bother tickers take longer than expected
R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/5752058
2012-03-07 01:10:55 +08:00
Robert Griesemer
7c6654aa70 all: fixed various typos
(Semi-automatically detected.)

R=golang-dev, remyoudompheng, r
CC=golang-dev
https://golang.org/cl/5715052
2012-03-01 14:56:05 -08:00
Brad Fitzpatrick
8c5290502f time: skip a often-flaky test in short mode
In -test.short mode, skip measuring the upper bound of time
sleeps. The API only guarantees minimum bounds on sleeps,
anyway, so this isn't a bug we're ignoring as much as it is
simply observing bad builder virtualization and/or loaded
machines.

We keep the test in full mode where developers will
presumably be running on a lightly-loaded, native, fast
machine.

R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/5713044
2012-02-29 13:14:05 -08:00
Rémy Oudompheng
c10f50859e all: remove various unused unexported functions and constants.
R=golang-dev, minux.ma, rsc
CC=golang-dev, remy
https://golang.org/cl/5702050
2012-02-28 21:48:03 +01:00
Rob Pike
d781603931 time: add a comment about how to use the Duration constants
R=golang-dev, bradfitz, r, dsymonds
CC=golang-dev
https://golang.org/cl/5696078
2012-02-26 22:24:51 +11:00
Alex Brainman
fea7f07e56 time: run full TestTicker test even during short tests
R=golang-dev, r, bradfitz, r
CC=golang-dev
https://golang.org/cl/5689076
2012-02-23 12:07:59 +11:00
Fazlul Shahriar
441538eb57 os,time: fix Plan 9 build
R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/5689043
2012-02-20 12:31:24 +11:00
Russ Cox
cb5e181fe7 time: switch to using (uncompressed) zoneinfo zip file
Removal of old zoneinfo files is a separate CL due to its size.

R=golang-dev, bradfitz, r
CC=golang-dev
https://golang.org/cl/5676100
2012-02-19 03:16:20 -05:00
Russ Cox
ad17a9c0a9 time: use Go distribution zoneinfo if system copy not found
Fixes #2964.

R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/5656101
2012-02-18 21:02:41 -05:00
Andrew Gerrand
11e113db57 godoc: make example code more readable with new comment convention
go/doc: move Examples to go/ast
cmd/go: use go/doc to read examples
src/pkg: update examples to use new convention

This is to make whole file examples more readable. When presented as a
complete function, preceding an Example with its output is confusing.
The new convention is to put the expected output in the final comment
of the example, preceded by the string "output:" (case insensitive).

An idiomatic example looks like this:

// This example demonstrates Foo by doing bar and quux.
func ExampleFoo() {
        // example body that does bar and quux

        // Output:
        // example output
}

R=rsc, gri
CC=golang-dev
https://golang.org/cl/5673053
2012-02-16 11:50:28 +11:00
Alex Brainman
9a44560033 time: run TestTicker for longer during short test, otherwise it fails
R=golang-dev, r
CC=golang-dev
https://golang.org/cl/5671049
2012-02-15 14:56:47 +11:00
Rémy Oudompheng
2a6e6999a4 runtime, time: accelerate tests in short mode.
before   after
go test -short time                4.144s  1.215s
go test -short runtime             1.315s  0.351s
go test -short -cpu=1,2,4 runtime  4.376s  1.266s

Partially solves issue 3015.

R=golang-dev, r
CC=golang-dev, remy
https://golang.org/cl/5673045
2012-02-14 22:13:19 +01:00
Russ Cox
d599accafa time: use "2006-01-02 15:04:05.999999999 -0700 MST" as String format
This change shows all the information present
in the Time value (now including fractional seconds)
and also arranges the fields so that, within a single time zone,
string comparison and time comparison agree.

R=golang-dev, rogpeppe, r
CC=golang-dev
https://golang.org/cl/5654078
2012-02-14 11:17:48 -05:00
Rob Pike
1bfffb67d8 time: improve commentary about standard time and formatting/parsing
Fixes #2965.

R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/5652054
2012-02-10 13:52:19 +11:00
Russ Cox
1d8250c8b0 time: clean up MarshalJSON, add RFC3339 method
encoding/xml: handle time.Time as recognized type

The long term plan is to define an interface that time.Time
can implement and that encoding/xml can call, but we are
not going to try to define that interface before Go 1.
Instead, special-case time.Time in package xml, because
it is such a fundamental type, as a stop-gap.
The eventual methods will behave this way.

Fixes #2793.

R=golang-dev, r, r, n13m3y3r
CC=golang-dev
https://golang.org/cl/5634051
2012-02-07 23:37:25 -05:00
Russ Cox
2050a9e478 build: remove Make.pkg, Make.tool
Consequently, remove many package Makefiles,
and shorten the few that remain.

gomake becomes 'go tool make'.

Turn off test phases of run.bash that do not work,
flagged with $BROKEN.  Future CLs will restore these,
but this seemed like a big enough CL already.

R=golang-dev, r
CC=golang-dev
https://golang.org/cl/5601057
2012-01-30 23:43:46 -05:00
Olivier Duperray
e5c1f3870b pkg: Add & fix Copyright of "hand generated" files
R=golang-dev, r
CC=golang-dev
https://golang.org/cl/5554064
2012-01-19 10:14:56 -08:00
Sameer Ajmani
20812c4907 time: add Since, which returns the time elapsed since some past time t.
R=rsc, r
CC=golang-dev
https://golang.org/cl/5532088
2012-01-18 15:25:00 -05:00
Rob Pike
eaecf357e7 time: delete unused buffer.WriteByte method
R=golang-dev, bradfitz, r, rsc
CC=golang-dev
https://golang.org/cl/5539056
2012-01-13 11:47:55 -08:00
Sameer Ajmani
1379d90651 time: fix godoc for After and NewTicker.
R=golang-dev, gri, bradfitz, iant
CC=golang-dev, rsc
https://golang.org/cl/5523049
2012-01-07 20:53:53 -05:00
David Symonds
f298d0ce29 time: add ParseDuration.
R=rsc, r, r
CC=golang-dev
https://golang.org/cl/5489111
2011-12-23 16:28:56 +11:00
Joel Sing
9ca57a706c crypto/mime/net/time: add netbsd to +build tags
R=golang-dev, mikioh.mikioh
CC=golang-dev
https://golang.org/cl/5501052
2011-12-21 21:44:47 +11:00
Robert Hencke
317ad14c6a time: JSON marshaler for Time
R=golang-dev, dsymonds, hectorchu, r, r
CC=golang-dev
https://golang.org/cl/5496064
2011-12-20 09:01:18 -08:00
Roger Peppe
cebf55dc9b time: new AddDate method
R=rsc
CC=golang-dev
https://golang.org/cl/5465044
2011-12-15 11:23:01 -05:00
Russ Cox
fc7b9fc269 time: allow sleep tests to run for 200% too long
Some VMs are slow.  Very slow.
Fixes #2421.

R=golang-dev, r
CC=golang-dev
https://golang.org/cl/5482049
2011-12-12 18:33:47 -05:00
Anthony Martin
1cb254a085 time: fix Plan 9 build for new API
I had to move readFile into sys_$GOOS.go
since syscall.Open takes only two arguments
on Plan 9.

R=lucio.dere, rsc, alex.brainman
CC=golang-dev
https://golang.org/cl/5447061
2011-12-12 16:12:22 -05:00
Robert Hencke
d0cf3fa21e time: gob marshaler for Time
Addresses issue 2526

R=rsc, r
CC=golang-dev
https://golang.org/cl/5448114
2011-12-12 16:08:29 -05:00
Christopher Nielsen
728c16cf13 build: Changes to the build infrastructure for NetBSD.
R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/5476048
2011-12-12 15:42:06 -05:00
Hector Chu
fdb09d289a time: fix Time.Add
R=rsc, r
CC=golang-dev
https://golang.org/cl/5448121
2011-12-10 21:55:38 +00:00
David Symonds
2949f3b659 time: use Duration for AfterFunc.
R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/5465043
2011-12-08 15:42:44 +11:00
Peter Mundy
69191553e7 time: fix daysIn for December
daysBefore[12+1]: index out of range
time.December and Windows SYSTEMTIME.wMonth
are 12 for December.

R=rsc, dsymonds
CC=golang-dev
https://golang.org/cl/5448130
2011-12-07 14:47:25 -05:00
Russ Cox
2666b815a3 use new strconv API
All but 3 cases (in gcimporter.go and hixie.go)
are automatic conversions using gofix.

No attempt is made to use the new Append functions
even though there are definitely opportunities.

R=golang-dev, gri
CC=golang-dev
https://golang.org/cl/5447069
2011-12-05 15:48:46 -05:00
Rob Pike
473de60359 time: update doc string for Error method
Fixes #2512.

R=golang-dev, gri
CC=golang-dev
https://golang.org/cl/5449057
2011-12-01 11:44:17 -08:00
Alex Brainman
68e30a9765 time: fix windows build
R=rsc
CC=golang-dev
https://golang.org/cl/5440071
2011-12-01 15:26:28 +11:00
Russ Cox
97197a6248 time: fix windows build
TBR=brainman
CC=golang-dev
https://golang.org/cl/5447057
2011-11-30 15:45:24 -05:00
Russ Cox
8dce57e169 os: new FileInfo, FileMode types + update tree
R=golang-dev, r, r, gri, bradfitz, iant, iant, nigeltao, n13m3y3r
CC=golang-dev
https://golang.org/cl/5416060
2011-11-30 12:04:16 -05:00
Russ Cox
efe3d35fc5 time: new Time, Duration, ZoneInfo types
R=r, bradfitz, gri, dsymonds, iant
CC=golang-dev
https://golang.org/cl/5392041
2011-11-30 11:59:44 -05:00
Dmitriy Vyukov
a899a467f2 time: fix timer stop
Due to data structure corruption,
some timers could not be removed.
Fixes #2495.

R=golang-dev, adg
CC=golang-dev, mdbrown
https://golang.org/cl/5437060
2011-11-25 14:13:10 +03:00
Lucio De Re
087a34869a syscall, os, time: fix Plan 9 build
R=rsc, bradfitz
CC=golang-dev
https://golang.org/cl/5371092
2011-11-16 17:37:54 -05:00
Dmitriy Vyukov
ba98a7ee5e time: fix test hang
R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/5374083
2011-11-14 22:31:39 +03:00
Dmitriy Vyukov
dc6726b37f runtime: fix timers crash
Timer callbacks occasionally crash
with "sched while holding locks" message.

R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/5381043
2011-11-14 21:59:48 +03:00
Russ Cox
c017a8299f syscall: use error
- syscall (not os) now defines the Errno type.
- the low-level assembly functions Syscall, Syscall6, and so on
  return Errno, not uintptr
- syscall wrappers all return error, not uintptr.

R=golang-dev, mikioh.mikioh, r, alex.brainman
CC=golang-dev
https://golang.org/cl/5372080
2011-11-13 22:44:52 -05:00
Russ Cox
b126902e84 time: remove unused sysSleep
R=golang-dev, dsymonds, r
CC=golang-dev
https://golang.org/cl/5369094
2011-11-13 22:42:57 -05:00
Anthony Martin
a6c501e4b1 net, io/ioutil: remove use of os.Time
I had to replace the single use of io/ioutil
in the time package with a bytes.Buffer since
there would've been a dependency cycle.

There are no other uses of os.Time.

R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/5372054
2011-11-11 14:40:41 -05:00
Volker Dobler
d989709630 time: add ISOWeek method to Time
As the ISO 8601 week number is untrivial to compute a new method
on *Time provides year and number of week.

R=golang-dev, rsc, r, r
CC=golang-dev
https://golang.org/cl/5316074
2011-11-10 12:40:50 -08:00
Russ Cox
3b860269ee runtime: add timer support, use for package time
This looks like it is just moving some code from
time to runtime (and translating it to C), but the
runtime can do a better job managing the goroutines,
and it needs this functionality for its own maintenance
(for example, for the garbage collector to hand back
unused memory to the OS on a time delay).
Might as well have just one copy of the timer logic,
and runtime can't depend on time, so vice versa.

It also unifies Sleep, NewTicker, and NewTimer behind
one mechanism, so that there are no claims that one
is more efficient than another.  (For example, today
people recommend using time.After instead of time.Sleep
to avoid blocking an OS thread.)

Fixes #1644.
Fixes #1731.
Fixes #2190.

R=golang-dev, r, hectorchu, iant, iant, jsing, alex.brainman, dvyukov
CC=golang-dev
https://golang.org/cl/5334051
2011-11-09 15:17:05 -05:00
Russ Cox
f437331f80 time: faster Nanoseconds call
runtime knows how to get the time of day
without allocating memory.

R=golang-dev, dsymonds, dave, hectorchu, r, cw
CC=golang-dev
https://golang.org/cl/5297078
2011-11-03 17:35:28 -04:00
Russ Cox
965845a86d all: sort imports
R=golang-dev, r
CC=golang-dev
https://golang.org/cl/5319072
2011-11-02 15:54:16 -04:00
Russ Cox
eb6929299b src/pkg/[n-z]*: gofix -r error -force=error
R=golang-dev, bsiegert, iant
CC=golang-dev
https://golang.org/cl/5294074
2011-11-01 22:05:34 -04:00
Scott Lawrence
a7e473be95 time: add RFC1123 with numeric timezone format
Fixes #841.

R=rsc, r
CC=golang-dev
https://golang.org/cl/5322058
2011-10-31 12:59:06 -07:00
Paul Borman
93b8438e59 time: make month/day name comparisons case insenstive
Fixes #2324.

R=r, r
CC=golang-dev
https://golang.org/cl/5180044
2011-10-04 12:52:30 -07:00
Russ Cox
2715956f13 build: add build comments to core packages
The go/build package already recognizes
system-specific file names like

        mycode_darwin.go
        mycode_darwin_386.go
        mycode_386.s

However, it is also common to write files that
apply to multiple architectures, so a recent CL added
to go/build the ability to process comments
listing a set of conditions for building.  For example:

        // +build darwin freebsd openbsd/386

says that this file should be compiled only on
OS X, FreeBSD, or 32-bit x86 OpenBSD systems.

These conventions are not yet documented
(hence this long CL description).

This CL adds build comments to the multi-system
files in the core library, a step toward making it
possible to use go/build to build them.

With this change go/build can handle crypto/rand,
exec, net, path/filepath, os/user, and time.

os and syscall need additional adjustments.

R=golang-dev, r, gri, r, gustavo
CC=golang-dev
https://golang.org/cl/5011046
2011-09-15 16:48:57 -04:00
Alex Brainman
cd269b0c2b time: another attempt to fix windows build
R=bradfitz
CC=golang-dev
https://golang.org/cl/4967067
2011-09-13 12:42:24 +10:00
Brad Fitzpatrick
29d5d9a5bb time: fix Windows build after ceeedb519c4a
R=golang-dev, r
CC=golang-dev
https://golang.org/cl/4983060
2011-09-12 17:18:25 -07:00
Rob Pike
7d43b84282 time: make Weekday a method.
Weekday is redundant information for a Time structure.
When parsing a time with a weekday specified, it can create an
incorrect Time value.
When parsing a time without a weekday specified, people
expect the weekday to be set.
Fix all three problems by computing the weekday on demand.

This is hard to gofix, since we must change the type of the node.
Since uses are rare and existing code will be caught by the compiler,
there is no gofix module here.

Fixes #2245.

R=golang-dev, bradfitz, rsc
CC=golang-dev
https://golang.org/cl/4974077
2011-09-12 11:47:55 -07:00
Fazlul Shahriar
45bd7b07e5 time: fix Plan 9 build
R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/4966045
2011-08-29 09:35:08 -04:00
Russ Cox
75d337e84b time: fix zone during windows test
Factor out sleep interrupt.

Fixes #1109.

R=alex.brainman, go.peter.90, mattn.jp
CC=golang-dev
https://golang.org/cl/4968041
2011-08-26 15:15:23 -04:00
Joel Sing
8c46e47b61 crypto, exec, path, time: add support for OpenBSD
R=golang-dev, r
CC=golang-dev
https://golang.org/cl/4837048
2011-08-12 14:44:16 +10:00
Rob Pike
c9cf04a9f6 time: allow the input to have fractional seconds even if
the format string does not specify its presence.

R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/4839059
2011-08-10 23:24:45 +10:00
Rob Pike
3c10403784 time: parse and format fractional seconds
R=golang-dev, rogpeppe, r, dsymonds, bradfitz, fvbommel
CC=golang-dev
https://golang.org/cl/4830065
2011-08-08 07:50:17 +10:00
Alex Brainman
be269b2f6d time: fix windows build
R=golang-dev, mattn.jp, dsymonds
CC=golang-dev
https://golang.org/cl/4849042
2011-08-05 17:19:17 +10:00
Rob Pike
bfaa175e09 time: add nanoseconds to the Time structure.
R=golang-dev, dsymonds, bradfitz, kevlar, rsc, r
CC=golang-dev
https://golang.org/cl/4851041
2011-08-05 13:44:02 +10:00
Robert Griesemer
95117d30a2 time: typo in documentation
R=r
CC=golang-dev
https://golang.org/cl/4763048
2011-07-18 17:54:32 -07:00
Robert Griesemer
90564a9256 go/printer: changed max. number of newlines from 3 to 2
manual changes in src/pkg/go/printer, src/cmd/gofix/signal_test.go
(cd src/cmd/gofix/testdata; gofmt -w *.in *.out)
(cd src/pkg/go/printer; gotest -update)
gofmt -w misc src

runs all tests

R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/4715041
2011-07-14 14:39:40 -07:00
Andrew Gerrand
5bcbcab311 sort: rename helpers: s/Sort// in sort.Sort[Float64s|Ints|Strings]
Includes 'sorthelpers' gofix and updates to tree.

R=golang-dev, gri
CC=golang-dev
https://golang.org/cl/4631098
2011-07-08 10:52:50 +10:00
Rob Pike
de36d19dfb time: zero-pad two-digit years.
Fixes #2024

R=adg, dsymonds
CC=golang-dev
https://golang.org/cl/4635083
2011-06-30 14:05:29 +10:00
Robert Griesemer
712fb6dcd3 os.Error API: don't export os.ErrorString, use os.NewError consistently
This is a core API change.

1) gofix misc src
2) Manual adjustments to the following files under src/pkg:
   gob/decode.go
   rpc/client.go
   os/error.go
   io/io.go
   bufio/bufio.go
   http/request.go
   websocket/client.go
as well as:
   src/cmd/gofix/testdata/*.go.in (reverted)
   test/fixedbugs/bug243.go
3) Implemented gofix patch (oserrorstring.go) and test case (oserrorstring_test.go)

Compiles and runs all tests.

R=r, rsc, gri
CC=golang-dev
https://golang.org/cl/4607052
2011-06-22 10:52:47 -07:00
Anthony Martin
d119e3bc0f time: add support for Plan 9
R=paulzhol, mirtchovski, r, r, rsc
CC=golang-dev
https://golang.org/cl/4362041
2011-06-19 16:36:33 +10:00
Robert Hencke
3fbd478a8a pkg: spelling tweaks, I-Z
also, a few miscellaneous fixes to files outside pkg

R=golang-dev, dsymonds, mikioh.mikioh, r
CC=golang-dev
https://golang.org/cl/4517116
2011-05-30 18:02:59 +10:00
Rob Pike
5a35757f3f time: midnight is 12AM.
This is the other half of the problem fixed at noon by the previous change.

R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/4515150
2011-05-28 07:06:53 +10:00
Rob Pike
406d73876d time: fix Format bug: noon is 12PM, not 0PM.
Fixes #1882.

R=golang-dev, dsymonds
CC=golang-dev
https://golang.org/cl/4556062
2011-05-27 23:24:39 +10:00
Kyle Consalus
78a7dda739 time: Remove unnecessary call to Nanoseconds() in after().
R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/4528091
2011-05-23 12:38:51 -07:00
Ian Lance Taylor
41e5de2184 time: Support Irix 6 location for zoneinfo files.
R=rsc
CC=golang-dev
https://golang.org/cl/4440066
2011-04-25 12:37:00 -07:00
Nigel Tao
6a186d38d1 src/pkg: make package doc comments consistently start with "Package foo".
R=rsc
CC=golang-dev
https://golang.org/cl/4442064
2011-04-20 09:57:05 +10:00
Andrew Gerrand
d54c4ecc32 time: make TestAfterQueuing retry 3 times before declaring failure.
I'm in two minds as to whether this should be a function of gotest.
Tests that can flake out like this should be rare enough that we
needn't add more mechanism.

R=r
CC=golang-dev
https://golang.org/cl/4335042
2011-03-30 11:40:00 +11:00
Rob Pike
45aeca4727 time: give a helpful message when we can't set the time zone for testing.
Fixes #1625.

R=bradfitzgo, bradfitzwork, r2
CC=golang-dev
https://golang.org/cl/4295060
2011-03-21 13:48:31 -07:00
Russ Cox
2ca46a789b time: isolate syscall reference in sys.go
R=dsymonds
CC=golang-dev
https://golang.org/cl/4291052
2011-03-17 13:46:05 -04:00
Peter Mundy
87aa93457e time: fix Time.ZoneOffset documentation
R=rsc
CC=golang-dev
https://golang.org/cl/4240090
2011-03-08 12:33:49 -05:00
David Symonds
4c30ca067d time: split os-dependent part into sys.go.
R=rsc
CC=golang-dev
https://golang.org/cl/4259051
2011-03-04 19:57:39 -08:00
Russ Cox
f4e76d8309 replace non-blocking send, receive syntax with select
R=golang-dev, nigeltao, niemeyer, r
CC=golang-dev
https://golang.org/cl/4079053
2011-01-31 18:36:28 -05:00
Ian Lance Taylor
64c7f70c66 time: Support Solaris zoneinfo directory.
R=rsc
CC=golang-dev
https://golang.org/cl/4079047
2011-01-28 15:56:14 -08:00
Roger Peppe
2ae953bfc3 time: allow cancelling of After events.
Also simplify sleeper algorithm and poll
occasionally so redundant sleeper goroutines
will quit sooner.

R=r, niemeyer, r2
CC=golang-dev
https://golang.org/cl/4063043
2011-01-25 12:25:48 -08:00
Roger Peppe
212e074be2 time: add AfterFunc to call a function after a given duration.
The After code is trivially generalisable to provide support
for this, and it is possible to use AfterFunc to do
things that After cannot, such as waiting
for many events at varied times without an overhead
of one goroutine per event.

R=rsc, r
CC=golang-dev
https://golang.org/cl/3905041
2011-01-10 11:51:38 -08:00
Eoghan Sherry
0c02bd1801 time: fix tick accuracy when using multiple Tickers
* correctly ignore obsolete ticks
* fix update of next alarm time
* tighten alarm channel buffers
Fixes #1379.

R=r, adg, r2
CC=golang-dev, soul9
https://golang.org/cl/3789045
2011-01-08 21:24:44 -08:00
Rob Pike
f383062e01 time.NewTicker: panic for intervals <= 0.
Not absolutely certain it's right to do this, but since there's
no error value coming back, it seems reasonable.

Fixes #1392.

R=rsc, adg
CC=golang-dev
https://golang.org/cl/3896042
2011-01-07 14:41:46 -08:00
Rob Pike
2e8be52ff7 time: explain the formats a little better.
R=gri, rsc
CC=golang-dev
https://golang.org/cl/3719042
2010-12-16 13:25:41 -08:00
Russ Cox
0c54225b51 remove nacl
The recent linker changes broke NaCl support
a month ago, and there are no known users of it.

The NaCl code can always be recovered from the
repository history.

R=adg, r
CC=golang-dev
https://golang.org/cl/3671042
2010-12-15 11:49:23 -05:00
Rob Pike
2ef09148a0 time: fix bug in Ticker: shutdown using channel rather than memory
R=rsc
CC=golang-dev
https://golang.org/cl/3609042
2010-12-13 13:52:19 -08:00
Rob Pike
1ce6245d6c throughout: fix broken calls to Printf etc.
I have written a tool to verify Printf calls, and although it's not
ready to be reviewed yet it's already uncovered a spate of problems
in the repository.  I'm sending this CL to break the changes into
pieces; as the tool improves it will find more, I'm sure.

R=rsc
CC=golang-dev
https://golang.org/cl/3427043
2010-12-07 16:42:54 -05:00
Russ Cox
6eee9ed507 time: fix build
Allow less precise timing on build machines.

TBR=r
CC=golang-dev
https://golang.org/cl/3391043
2010-12-06 16:22:32 -05:00
Roger Peppe
e2d1595c81 time: make After use fewer goroutines and host processes.
With credit to Gustavo Niemeyer, who hinted at this approach
in #go-nuts.

R=adg, rsc, niemeyer, r
CC=golang-dev
https://golang.org/cl/3416043
2010-12-06 14:19:30 -05:00
Robert Griesemer
3478891d12 gofmt -s -w src misc
R=r, rsc
CC=golang-dev
https://golang.org/cl/2662041
2010-10-22 10:06:33 -07:00
Andrew Gerrand
1e66a21348 time: add After
Permits one to easily put a timeout in a select:

select {
case <-ch:
	// foo
case <-time.After(1e6):
	// bar
}

R=r, rog, rsc, sameer1, PeterGo, iant, nigeltao_gnome
CC=golang-dev
https://golang.org/cl/2321043
2010-10-11 13:45:26 +11:00
Rob Pike
1959c3ac5b tests: fix prints
- delete unnecessary newlines
- make sure formatted prints call the formatting routines

R=adg
CC=golang-dev
https://golang.org/cl/2225046
2010-09-23 13:48:56 +10:00
Russ Cox
be443ee8bc 5g: register allocation bugs
Fixes #1099.

R=ken2, r
CC=golang-dev
https://golang.org/cl/2147047
2010-09-12 00:06:45 -04:00