269 // 1 1 0 Reserved, Microsoft backward compatibility
270 // 1 1 1 Reserved for future definition.
271 return (int) ((leastSigBits >>> (64 - (leastSigBits >>> 62)))
272 & (leastSigBits >> 63));
273 }
274
275 /**
276 * The timestamp value associated with this UUID.
277 *
278 * <p> The 60 bit timestamp value is constructed from the time_low,
279 * time_mid, and time_hi fields of this {@code UUID}. The resulting
280 * timestamp is measured in 100-nanosecond units since midnight,
281 * October 15, 1582 UTC.
282 *
283 * <p> The timestamp value is only meaningful in a time-based UUID, which
284 * has version type 1. If this {@code UUID} is not a time-based UUID then
285 * this method throws UnsupportedOperationException.
286 *
287 * @throws UnsupportedOperationException
288 * If this UUID is not a version 1 UUID
289 */
290 public long timestamp() {
291 if (version() != 1) {
292 throw new UnsupportedOperationException("Not a time-based UUID");
293 }
294
295 return (mostSigBits & 0x0FFFL) << 48
296 | ((mostSigBits >> 16) & 0x0FFFFL) << 32
297 | mostSigBits >>> 32;
298 }
299
300 /**
301 * The clock sequence value associated with this UUID.
302 *
303 * <p> The 14 bit clock sequence value is constructed from the clock
304 * sequence field of this UUID. The clock sequence field is used to
305 * guarantee temporal uniqueness in a time-based UUID.
306 *
307 * <p> The {@code clockSequence} value is only meaningful in a time-based
308 * UUID, which has version type 1. If this UUID is not a time-based UUID
|
269 // 1 1 0 Reserved, Microsoft backward compatibility
270 // 1 1 1 Reserved for future definition.
271 return (int) ((leastSigBits >>> (64 - (leastSigBits >>> 62)))
272 & (leastSigBits >> 63));
273 }
274
275 /**
276 * The timestamp value associated with this UUID.
277 *
278 * <p> The 60 bit timestamp value is constructed from the time_low,
279 * time_mid, and time_hi fields of this {@code UUID}. The resulting
280 * timestamp is measured in 100-nanosecond units since midnight,
281 * October 15, 1582 UTC.
282 *
283 * <p> The timestamp value is only meaningful in a time-based UUID, which
284 * has version type 1. If this {@code UUID} is not a time-based UUID then
285 * this method throws UnsupportedOperationException.
286 *
287 * @throws UnsupportedOperationException
288 * If this UUID is not a version 1 UUID
289 * @return The timestamp of this {@code UUID}.
290 */
291 public long timestamp() {
292 if (version() != 1) {
293 throw new UnsupportedOperationException("Not a time-based UUID");
294 }
295
296 return (mostSigBits & 0x0FFFL) << 48
297 | ((mostSigBits >> 16) & 0x0FFFFL) << 32
298 | mostSigBits >>> 32;
299 }
300
301 /**
302 * The clock sequence value associated with this UUID.
303 *
304 * <p> The 14 bit clock sequence value is constructed from the clock
305 * sequence field of this UUID. The clock sequence field is used to
306 * guarantee temporal uniqueness in a time-based UUID.
307 *
308 * <p> The {@code clockSequence} value is only meaningful in a time-based
309 * UUID, which has version type 1. If this UUID is not a time-based UUID
|