Lines Matching full:nsec
44 // nsec specifies a non-negative nanosecond
47 nsec int32
59 return t.sec > u.sec || t.sec == u.sec && t.nsec > u.nsec
64 return t.sec < u.sec || t.sec == u.sec && t.nsec < u.nsec
73 return t.sec == u.sec && t.nsec == u.nsec
151 // time would be represented by sec=-1, nsec=1e9. However, it does
242 return t.sec == 0 && t.nsec == 0
417 return int(t.nsec)
591 nsec := d % Second
592 return float64(sec) + float64(nsec)*1e-9
598 nsec := d % Minute
599 return float64(min) + float64(nsec)*(1e-9/60)
605 nsec := d % Hour
606 return float64(hour) + float64(nsec)*(1e-9/60/60)
612 nsec := int32(t.nsec) + int32(d%1e9)
613 if nsec >= 1e9 {
615 nsec -= 1e9
616 } else if nsec < 0 {
618 nsec += 1e9
620 t.nsec = nsec
629 d := Duration(t.sec-u.sec)*Second + Duration(int32(t.nsec)-int32(u.nsec))
658 return Date(year+years, month+Month(months), day+days, hour, min, sec, int(t.nsec), t.loc)
778 func now() (sec int64, nsec int32)
782 sec, nsec := now()
783 return Time{sec + unixToInternal, nsec, Local}
836 return (t.sec+internalToUnix)*1e9 + int64(t.nsec)
869 byte(t.nsec >> 24), // bytes 9-12: nanoseconds
870 byte(t.nsec >> 16),
871 byte(t.nsec >> 8),
872 byte(t.nsec),
891 if len(buf) != /*version*/ 1+ /*sec*/ 8+ /*nsec*/ 4+ /*zone offset*/ 2 {
900 t.nsec = int32(buf[3]) | int32(buf[2])<<8 | int32(buf[1])<<16 | int32(buf[0])<<24
967 // sec seconds and nsec nanoseconds since January 1, 1970 UTC.
968 // It is valid to pass nsec outside the range [0, 999999999].
971 func Unix(sec int64, nsec int64) Time {
972 if nsec < 0 || nsec >= 1e9 {
973 n := nsec / 1e9
975 nsec -= n * 1e9
976 if nsec < 0 {
977 nsec += 1e9
981 return Time{sec + unixToInternal, int32(nsec), Local}
1006 // yyyy-mm-dd hh:mm:ss + nsec nanoseconds
1009 // The month, day, hour, min, sec, and nsec values may be outside
1021 func Date(year int, month Month, day, hour, min, sec, nsec int, loc *Location) Time {
1031 // Normalize nsec, sec, min, hour, overflowing into day.
1032 sec, nsec = norm(sec, nsec, 1e9)
1090 return Time{unix + unixToInternal, int32(nsec), loc}
1122 nsec := int32(t.nsec)
1127 nsec = -nsec
1128 if nsec < 0 {
1129 nsec += 1e9
1137 qmod2 = int(nsec/int32(d)) & 1
1138 r = Duration(nsec % int32(d))
1144 r = Duration(t.sec%d1)*Second + Duration(nsec)
1161 u0x, u0 = u0, u0+uint64(nsec)