@@ -26,6 +26,16 @@ public class Timestamp : ITimestamp
2626 private const long NANOS_PER_MILLI = 1000 * 1000 ;
2727 private const long NANOS_PER_SECOND = NANOS_PER_MILLI * MILLIS_PER_SECOND ;
2828
29+ internal Timestamp ( long seconds , int nanos )
30+ {
31+ this . Seconds = seconds ;
32+ this . Nanos = nanos ;
33+ }
34+
35+ public long Seconds { get ; }
36+
37+ public int Nanos { get ; }
38+
2939 public static ITimestamp Create ( long seconds , int nanos )
3040 {
3141 // TODO:
@@ -49,24 +59,6 @@ public static ITimestamp FromMillis(long millis)
4959 return zero . Plus ( 0 , nanos ) ;
5060 }
5161
52- internal Timestamp ( long seconds , int nanos )
53- {
54- this . Seconds = seconds ;
55- this . Nanos = nanos ;
56- }
57-
58- public long Seconds { get ; }
59-
60- public int Nanos { get ; }
61-
62- private static ITimestamp OfSecond ( long seconds , long nanoAdjustment )
63- {
64- long floor = ( long ) Math . Floor ( ( double ) nanoAdjustment / NANOS_PER_SECOND ) ;
65- long secs = seconds + floor ;
66- long nos = nanoAdjustment - ( floor * NANOS_PER_SECOND ) ;
67- return Create ( secs , ( int ) nos ) ;
68- }
69-
7062 public ITimestamp AddDuration ( IDuration duration )
7163 {
7264 return this . Plus ( duration . Seconds , duration . Nanos ) ;
@@ -140,6 +132,14 @@ public override int GetHashCode()
140132 return ( int ) h ;
141133 }
142134
135+ private static ITimestamp OfSecond ( long seconds , long nanoAdjustment )
136+ {
137+ long floor = ( long ) Math . Floor ( ( double ) nanoAdjustment / NANOS_PER_SECOND ) ;
138+ long secs = seconds + floor ;
139+ long nos = nanoAdjustment - ( floor * NANOS_PER_SECOND ) ;
140+ return Create ( secs , ( int ) nos ) ;
141+ }
142+
143143 private ITimestamp Plus ( long secondsToAdd , long nanosToAdd )
144144 {
145145 if ( ( secondsToAdd | nanosToAdd ) == 0 )
0 commit comments