Generate the next stream item ID given the previous one. If the current * milliseconds Unix time is greater than the previous one, just use this * as time part and start with sequence part of zero. Otherwise we use the * previous time (and never go backward) and increment the sequence. */
| 133 | * as time part and start with sequence part of zero. Otherwise we use the |
| 134 | * previous time (and never go backward) and increment the sequence. */ |
| 135 | void streamNextID(streamID *last_id, streamID *new_id) { |
| 136 | uint64_t ms = mstime(); |
| 137 | if (ms > last_id->ms) { |
| 138 | new_id->ms = ms; |
| 139 | new_id->seq = 0; |
| 140 | } else { |
| 141 | *new_id = *last_id; |
| 142 | streamIncrID(new_id); |
| 143 | } |
| 144 | } |
| 145 | |
| 146 | /* This is a helper function for the COPY command. |
| 147 | * Duplicate a Stream object, with the guarantee that the returned object |
no test coverage detected