The timestamp adjustment function uses the following procedure to adjust time information in tuples:
- Sets the timestamp
The function timestamps a tuple that has arrived at the SDP server. To do this, it first discards from the time value set in the records in the tuple any portion of the time value that is smaller than the specified unit of time. It then sets the resulting value as the timestamp for the tuple. For example, if sec is specified as the unit of time, any value smaller than a second, such as a milliseconds value, is discarded from the time value and the resulting value (in seconds) is set as the timestamp.
- Holds tuples
The function holds tuples whose timestamp falls within the range of times to be adjusted.
It also discards any tuple whose timestamp is earlier than the range of times to be adjusted.
- Inputs tuples to the input stream
Those tuples among the tuples that are being held that are now outside the range of times to be adjusted because of a change in the range are input to the input stream.
When the timestamp adjustment function holds tuples and inputs them to the input stream, the method used to adjust the tuples' time information and the order in which tuples are input to the input stream depend on the reference time, the time set in the records in the tuples, and the specified unit of time. This subsection discusses how to adjust a tuple's time and the order in which tuples are input to the input stream.
- Organization of this subsection
- (1) How to adjust a tuple's time
- (2) Order in which tuples are input to the input stream
Tuples whose time information has been adjusted by the timestamp adjustment function are input to the input stream in ascending order of the timestamps set by the timestamp adjustment function. In the case of multiple tuples with the same timestamp value, they are input to the input stream in the order they arrived at the SDP server.
If tuples have different units of time and ranges to be adjusted by the timestamp adjustment function, the order in which they are input to the input stream depends on several factors.
This subsection presents examples for different combinations of the unit of time and the range of times to be adjusted in order to discuss the timestamp set in tuples by the timestamp adjustment function and the order in which tuples would be input to the input stream.
The examples presented here assume that tuples A through E shown in the table below are sent from the input adaptor:
Tuple | Order sent from input adaptor | Time set in records in the tuple |
---|
A | 1 | 2009/03/01 12:15:22:345678901 |
B | 2 | 2009/03/01 12:15:22:123456789 |
C | 3 | 2009/03/01 12:15:23:123456789 |
D | 4 | 2009/03/01 12:15:22:890123456 |
E | 5 | 2009/03/01 12:15:24:123456789 |
- When sec is specified as the unit of time and 1 is specified for the range of times to be adjusted:
- The table below shows the timestamps set in these tuples by the timestamp adjustment function and the order in which the tuples are input to the input stream when sec is specified as the unit of time and 1 is specified for the range of times to be adjusted.
- Note that when sec is specified as the unit of time, the timestamp is expressed in whole seconds and any fractional part of a second is discarded.
Tuple | Input order | Timestamp set by timestamp adjustment function |
---|
A | 1 | 2009/03/01 12:15:22:000000000 |
B | 2 | 2009/03/01 12:15:22:000000000 |
C | 4 | 2009/03/01 12:15:23:000000000 |
D | 3 | 2009/03/01 12:15:22:000000000 |
E | 5 | 2009/03/01 12:15:24:000000000 |
- In this example, all tuples are input to the input stream because they all fall within the time adjustment range.
- When msec is specified as the unit of time and 999 is specified for the range of times to be adjusted:
- The table below shows the timestamps set in these tuples by the timestamp adjustment function and the order in which the tuples are input to the input stream when msec is specified as the unit of time and 999 is specified for the range of times to be adjusted.
- Note that when msec is specified as the unit of time, the timestamp is expressed in whole milliseconds and any fractional part of a millisecond is discarded.
Tuple | Input order | Timestamp set by timestamp adjustment function |
---|
A | 2 | 2009/03/01 12:15:22:345000000 |
B | 1 | 2009/03/01 12:15:22:123000000 |
C | 4 | 2009/03/01 12:15:23:123000000 |
D | 3 | 2009/03/01 12:15:22:890000000 |
E | 5 | 2009/03/01 12:15:24:123000000 |
- In this example, all tuples are input to the input stream because they are all within the time adjustment range.
- When usec is specified as the unit of time and 999 is specified for the range of times to be adjusted:
- The table below shows the timestamps set in these tuples by the timestamp adjustment function and the order in which the tuples are input to the input stream when usec is specified as the unit of time and 999 is specified for the range of times to be adjusted.
- Note that when usec is specified as the unit of time, the timestamp is expressed in whole microseconds and any fractional part of a microsecond is discarded.
Tuple | Input order | Timestamp set by timestamp adjustment function |
---|
A | 1 | 2009/03/01 12:15:22:345678000 |
B | Discarded | None set |
C | 2 | 2009/03/01 12:15:23:123456000 |
D | Discarded | None set |
E | 3 | 2009/03/01 12:15:24:123456000 |
- In this example, once tuple A's timestamp becomes the reference time, tuple B is discarded because its time is earlier than this reference time and is outside the range of times to be adjusted. Similarly, tuple D is discarded because its time is earlier than that of tuple C and is also outside the range of times to be adjusted.
- When sec is specified as the unit of time and 0 is specified for the range of times to be adjusted:
- The table below shows the timestamps set in these tuples by the timestamp adjustment function and the order in which the tuples are input to the input stream when sec is specified as the unit of time and 0 is specified for the range of times to be adjusted.
- Note that when sec is specified as the unit of time, the timestamp is expressed in whole seconds and any fractional part of a second is discarded.
Tuple | Input order | Timestamp set by timestamp adjustment function |
---|
A | 1 | 2009/03/01 12:15:22:000000000 |
B | 2 | 2009/03/01 12:15:22:000000000 |
C | 3 | 2009/03/01 12:15:22:000000000 |
D | Discarded | None set |
E | 4 | 2009/03/01 12:15:23:000000000 |
- In this example, only the reference time is within the time adjustment range. When tuple C is sent, its timestamp becomes the reference time and tuple D is discarded because its time is earlier than the reference time.