@@ -15,11 +15,11 @@ use crate::transform::{Input, Transform};
1515pub struct TimestampSource {
1616 start : u64 ,
1717 end : u64 ,
18- microseconds : bool ,
18+ milliseconds : bool ,
1919}
2020
2121impl TimestampSource {
22- pub fn from_dates ( start_date : & str , end_date : & str , microseconds : bool ) -> Result < Self > {
22+ pub fn from_dates ( start_date : & str , end_date : & str , milliseconds : bool ) -> Result < Self > {
2323 let start = NaiveDate :: parse_from_str ( start_date, "%Y-%m-%d" ) ?
2424 . and_hms_opt ( 0 , 0 , 0 )
2525 . unwrap ( )
@@ -50,7 +50,7 @@ impl TimestampSource {
5050 Ok ( Self {
5151 start,
5252 end,
53- microseconds ,
53+ milliseconds ,
5454 } )
5555 }
5656}
@@ -71,9 +71,9 @@ impl Source for TimestampSource {
7171 ) ;
7272 }
7373
74- if self . microseconds && self . end > ( u64:: MAX - 999 ) / 1000 {
74+ if self . milliseconds && self . end > ( u64:: MAX - 999 ) / 1000 {
7575 anyhow:: bail!(
76- "Timestamp value overflow in microseconds mode for end timestamp {}" ,
76+ "Timestamp value overflow in milliseconds mode for end timestamp {}" ,
7777 self . end
7878 ) ;
7979 }
@@ -89,10 +89,10 @@ impl Source for TimestampSource {
8989 self . end
9090 )
9191 } ) ?;
92- let total = if self . microseconds {
92+ let total = if self . milliseconds {
9393 count. checked_mul ( 1001 ) . ok_or_else ( || {
9494 anyhow:: anyhow!(
95- "Timestamp workload overflow in microseconds mode for {} inputs" ,
95+ "Timestamp workload overflow in milliseconds mode for {} inputs" ,
9696 count
9797 )
9898 } ) ?
@@ -110,8 +110,8 @@ impl Source for TimestampSource {
110110 // Process base timestamp
111111 process_timestamp ( ts, transforms, & deriver, matcher, output, & stats, & matches) ;
112112
113- // Process microseconds if enabled
114- if self . microseconds {
113+ // Process milliseconds if enabled
114+ if self . milliseconds {
115115 for ms in 0u64 ..1000 {
116116 let ts_ms = ts * 1000 + ms;
117117 process_timestamp (
@@ -153,11 +153,11 @@ mod tests {
153153 }
154154
155155 #[ test]
156- fn process_counts_microseconds_mode_correctly ( ) {
156+ fn process_counts_milliseconds_mode_correctly ( ) {
157157 let source = TimestampSource {
158158 start : 1 ,
159159 end : 1 ,
160- microseconds : true ,
160+ milliseconds : true ,
161161 } ;
162162 let deriver = KeyDeriver :: new ( ) ;
163163 let output = ConsoleOutput :: new ( ) ;
@@ -175,7 +175,7 @@ mod tests {
175175 let source = TimestampSource {
176176 start : 10 ,
177177 end : 1 ,
178- microseconds : false ,
178+ milliseconds : false ,
179179 } ;
180180 let deriver = KeyDeriver :: new ( ) ;
181181 let output = ConsoleOutput :: new ( ) ;
@@ -190,7 +190,7 @@ mod tests {
190190 let source = TimestampSource {
191191 start : 0 ,
192192 end : u64:: MAX ,
193- microseconds : false ,
193+ milliseconds : false ,
194194 } ;
195195 let deriver = KeyDeriver :: new ( ) ;
196196 let output = ConsoleOutput :: new ( ) ;
0 commit comments