// Raw returns underlying time.Duration value attached to Duration.
// This is the value originally passed to NewDuration.
//
// Example:
//  d := NewDuration(t, duration)
//  assert.Equal(t, timestamp, d.Raw())
359870
func (d *Duration) Raw() time.Duration {
	if d.value == nil {
		return 0
	}
	return *d.value
}
407357
func (r Raw) Compare(other Raw) int {
	return bytes.Compare(r[0:], other[0:])
}
1023476
func (key MvccKey) Raw() []byte {
	if len(key) == 0 {
		return nil
	}
	_, k, err := codec.DecodeBytes(key, nil)
	if err != nil {
		panic(err)
	}
	return k
}
348710
func (f *Frame) Duration() time.Duration {
	if !f.Header.IsValid() {
		return 0
	}
	ms := (1000 / float64(f.Header.SampleRate())) * float64(f.Header.Samples())
	dur := time.Duration(int(float64(time.Millisecond) * ms))
	if dur < 0 {
		// we have bad data, let's ignore it
		dur = 0
	}
	return dur
}
319697
func (c *CredentialValue) Raw() (interface{}, error) {
	if c.IsUnset() {
		return nil, errors.New("Cannot return raw value of an unset Credential")
	}

	return c.raw, nil
}
998503
func (d Duration) Compare(o Duration) int {
	if d.Duration > o.Duration {
		return 1
	} else if d.Duration == o.Duration {
		return 0
	} else {
		return -1
	}
}
772389
func Duration(p *durpb.Duration) (time.Duration, error) {
	if err := validateDuration(p); err != nil {
		return 0, err
	}
	d := time.Duration(p.Seconds) * time.Second
	if int64(d/time.Second) != p.Seconds {
		return 0, fmt.Errorf("duration: %v is out of range for time.Duration", p)
	}
	if p.Nanos != 0 {
		d += time.Duration(p.Nanos) * time.Nanosecond
		if (d < 0) != (p.Nanos < 0) {
			return 0, fmt.Errorf("duration: %v is out of range for time.Duration", p)
		}
	}
	return d, nil
}
537730
func (d *Duration) Equal(value time.Duration) *Duration {
	if d.value == nil {
		d.chain.fail("expected duration is set, but it is not")
		return d
	}
	if !(*d.value == value) {
		d.chain.fail("\nexpected duration equal to:\n %s\n\nbut got:\n %s",
			value, *d.value)
	}
	return d
}
316185
func (c *Client) raw(method, path string) ([]byte, error) {
	// create the URI
	uri, err := url.Parse(c.ApiUrl + path)
	if err != nil {
		return nil, err
	}

	// add the access token to the URL query string
	params := uri.Query()
	params.Add("access_token", c.Token)
	uri.RawQuery = params.Encode()

	// create the request
	req := &http.Request{
		URL           : uri,
		Method        : method,
		ProtoMajor    : 1,
		ProtoMinor    : 1,
		Close         : true,
		ContentLength : 0,
	}

	// set the appropariate headers
	req.Header = http.Header{}
	req.Header.Set("Content-Type", "application/json")

	// make the request using the default http client
	resp, err := DefaultClient.Do(req)
	if err != nil {
		return nil, err
	}

	// Read the bytes from the body (make sure we defer close the body)
	defer resp.Body.Close()
	return ioutil.ReadAll(resp.Body)
}
1100373
func (s *Sample) Duration() time.Duration {
	return s.End.Sub(s.Start)
}
526132
func Raw(b []byte) Field {
	return func(p *Packet) error {
		if p.Len()+len(b) > MaxEIRPacketLength {
			return ErrNotFit
		}
		p.b = append(p.b, b...)
		return nil
	}
}
1021563
func (t *Timedelta) Duration() time.Duration {
	return t.Days*24*time.Hour +
		t.Seconds*time.Second +
		t.Microseconds*time.Microsecond +
		t.Milliseconds*time.Millisecond +
		t.Minutes*time.Minute +
		t.Hours*time.Hour +
		t.Weeks*7*24*time.Hour
}
1033879
func (f *FlagSet) Duration(name string, value time.Duration, usage string) *time.Duration {
	p := new(time.Duration)
	f.DurationVar(p, name, value, usage)
	return p
}
1087115
func NewDuration(d time.Duration) *Duration {
	return &Duration{v: *NewInt64(int64(d))}
}
130821
func (d *Decoder) raw(f *codecFnInfo, rv reflect.Value) {
	rv.SetBytes(d.rawBytes())
}
703805
func (c *Coordinate) rawDistanceTo(other *Coordinate) float64 {
	return magnitude(diff(c.Vec, other.Vec)) + c.Height + other.Height
}
700504
func (dt *DateTime) Equal(value time.Time) *DateTime {
	if !dt.value.Equal(value) {
		dt.chain.fail("\nexpected datetime equal to:\n %s\n\nbut got:\n %s",
			value, dt.value)
	}
	return dt
}