core/src/main/java/org/sakaiproject/nakamura/api/lite/util/Type1UUID.java
public static byte[] next() {
        if (type1Initialized == false) {
            initializeForType1();
        }
        // set ip addr
        byte[] uuid = new byte[16];
        System.arraycopy(IP, 0, uuid, 10, IP.length);

        // Set time info. Have to do this processing within a synchronized
        // block because of the statics...
        long now = 0;
        synchronized (Type1UUID.class) {
            // Get the time to use for this uuid. This method has the side
            // effect of modifying the clock sequence, as well.
            now = getTime();

            // Insert the resulting clock sequence into the uuid
            uuid[IDX_TIME_SEQ] = (byte) ((_seq & 0x3F00) >>> 8);
            uuid[IDX_VARIATION] |= 0x80;
            uuid[IDX_TIME_SEQ + 1] = (byte) (_seq & 0xFF);

        }

        // have to break up time because bytes are spread through uuid
        byte[] timeBytes = toBytes(now);

        // Copy time low
        System.arraycopy(timeBytes, TS_TIME_LO_IDX, uuid, IDX_TIME_LO, TS_TIME_LO_LEN);
        // Copy time mid
        System.arraycopy(timeBytes, TS_TIME_MID_IDX, uuid, IDX_TIME_MID, TS_TIME_MID_LEN);
        // Copy time hi
        System.arraycopy(timeBytes, TS_TIME_HI_IDX, uuid, IDX_TIME_HI, TS_TIME_HI_LEN);
        // Set version (time-based)
        uuid[IDX_TYPE] |= TYPE_TIME_BASED; // 0001 0000

        return uuid;
    }
public static byte[] next() {
        if (type1Initialized == false) {
            initializeForType1();
        }
        // set ip addr
        byte[] uuid = new byte[16];
        System.arraycopy(IP, 0, uuid, 10, IP.length);

        // Set time info. Have to do this processing within a synchronized
        // block because of the statics...
        long now = 0;
        synchronized (Type1UUID.class) {
            // Get the time to use for this uuid. This method has the side
            // effect of modifying the clock sequence, as well.
            now = getTime();

            // Insert the resulting clock sequence into the uuid
            uuid[IDX_TIME_SEQ] = (byte) ((_seq & 0x3F00) >>> 8);
            uuid[IDX_VARIATION] |= 0x80;
            uuid[IDX_TIME_SEQ + 1] = (byte) (_seq & 0xFF);

        }

        // have to break up time because bytes are spread through uuid
        byte[] timeBytes = toBytes(now);

        // Copy time low
        System.arraycopy(timeBytes, TS_TIME_LO_IDX, uuid, IDX_TIME_LO, TS_TIME_LO_LEN);
        // Copy time mid
        System.arraycopy(timeBytes, TS_TIME_MID_IDX, uuid, IDX_TIME_MID, TS_TIME_MID_LEN);
        // Copy time hi
        System.arraycopy(timeBytes, TS_TIME_HI_IDX, uuid, IDX_TIME_HI, TS_TIME_HI_LEN);
        // Set version (time-based)
        uuid[IDX_TYPE] |= TYPE_TIME_BASED; // 0001 0000

        return uuid;
    }
public static byte [ ] next ( ) { if ( type1Initialized == false ) { initializeForType1 ( ) ; } // set ip addr byte [ ] uuid = new byte [ 16 ] ; System . arraycopy ( IP , 0 , uuid , 10 , IP . length ) ; // Set time info. Have to do this processing within a synchronized // block because of the statics... long now = 0 ; synchronized ( Type1UUID . class ) { // Get the time to use for this uuid. This method has the side // effect of modifying the clock sequence, as well. now = getTime ( ) ; // Insert the resulting clock sequence into the uuid uuid [ IDX_TIME_SEQ ] = ( byte ) ( ( _seq & 0x3F00 ) >>> 8 ) ; uuid [ IDX_VARIATION ] |= 0x80 ; uuid [ IDX_TIME_SEQ + 1 ] = ( byte ) ( _seq & 0xFF ) ; } // have to break up time because bytes are spread through uuid byte [ ] timeBytes = toBytes ( now ) ; // Copy time low System . arraycopy ( timeBytes , TS_TIME_LO_IDX , uuid , IDX_TIME_LO , TS_TIME_LO_LEN ) ; // Copy time mid System . arraycopy ( timeBytes , TS_TIME_MID_IDX , uuid , IDX_TIME_MID , TS_TIME_MID_LEN ) ; // Copy time hi System . arraycopy ( timeBytes , TS_TIME_HI_IDX , uuid , IDX_TIME_HI , TS_TIME_HI_LEN ) ; // Set version (time-based) uuid [ IDX_TYPE ] |= TYPE_TIME_BASED ; // 0001 0000 return uuid ; }
/*
Creates a type 1 UUID
/ * Creates a type 1 UUID