Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 4 of 4 for UnixMicro (0.11 sec)

  1. staging/src/k8s.io/apimachinery/pkg/apis/meta/v1/micro_time_test.go

    func TestMicroTimeUnmarshalJSONAndProtoEqual(t *testing.T) {
    	cases := []struct {
    		name   string
    		input  MicroTime
    		result bool
    	}{
    		{"nanosecond level precision", UnixMicro(123, 123123123), true},
    		{"microsecond level precision", UnixMicro(123, 123123000), true},
    	}
    
    	for _, c := range cases {
    		t.Run(c.name, func(t *testing.T) {
    			jsonData, err := c.input.MarshalJSON()
    			if err != nil {
    Registered: Sat Jun 15 01:39:40 UTC 2024
    - Last Modified: Wed May 29 21:48:10 UTC 2024
    - 11.1K bytes
    - Viewed (0)
  2. staging/src/k8s.io/apimachinery/pkg/apis/meta/v1/micro_time.go

    	if t == nil && u == nil {
    		return true
    	}
    	if t != nil && u != nil {
    		return t.Time.Equal(u.Time)
    	}
    	return false
    }
    
    // UnixMicro returns the local time corresponding to the given Unix time
    // by wrapping time.Unix.
    func UnixMicro(sec int64, nsec int64) MicroTime {
    	return MicroTime{time.Unix(sec, nsec)}
    }
    
    // UnmarshalJSON implements the json.Unmarshaller interface.
    Registered: Sat Jun 15 01:39:40 UTC 2024
    - Last Modified: Wed May 29 21:48:10 UTC 2024
    - 5.2K bytes
    - Viewed (0)
  3. src/time/time_test.go

    	{"UnixNano", func(t1, t2 Time) bool { return t1.UnixNano() == t2.UnixNano() }},
    	{"UnixMilli", func(t1, t2 Time) bool { return t1.UnixMilli() == t2.UnixMilli() }},
    	{"UnixMicro", func(t1, t2 Time) bool { return t1.UnixMicro() == t2.UnixMicro() }},
    
    	{"MarshalBinary", func(t1, t2 Time) bool {
    		a1, b1 := t1.MarshalBinary()
    		a2, b2 := t2.MarshalBinary()
    		return bytes.Equal(a1, a2) && b1 == b2
    	}},
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Thu May 23 03:13:47 UTC 2024
    - 56.5K bytes
    - Viewed (0)
  4. src/time/time.go

    }
    
    // UnixMicro returns t as a Unix time, the number of microseconds elapsed since
    // January 1, 1970 UTC. The result is undefined if the Unix time in
    // microseconds cannot be represented by an int64 (a date before year -290307 or
    // after year 294246). The result does not depend on the location associated
    // with t.
    func (t Time) UnixMicro() int64 {
    	return t.unixSec()*1e6 + int64(t.nsec())/1e3
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Wed May 29 17:58:53 UTC 2024
    - 50.7K bytes
    - Viewed (0)
Back to top