flymis/WebRoot/dojojs/src/uuid/TimeBasedGenerator.js
(开头部分) 14KB这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。
/*
Copyright (c) 2004-2006, The Dojo Foundation
All Rights Reserved.
Licensed under the Academic Free License version 2.1 or above OR the
modified BSD license. For more information on Dojo licensing, see:
http://dojotoolkit.org/community/licensing.shtml
*/
dojo.provide("dojo.uuid.TimeBasedGenerator");
dojo.require("dojo.lang.common");
dojo.require("dojo.lang.type");
dojo.require("dojo.lang.assert");
dojo.uuid.TimeBasedGenerator = new function() {
// --------------------------------------------------
// Public constants:
// Number of hours between October 15, 1582 and January 1, 1970:
this.GREGORIAN_CHANGE_OFFSET_IN_HOURS = 3394248;
// Number of seconds between October 15, 1582 and January 1, 1970:
// this.GREGORIAN_CHANGE_OFFSET_IN_SECONDS = 12219292800;
// --------------------------------------------------
// Private variables:
var _uuidPseudoNodeString = null;
var _uuidClockSeqString = null;
var _dateValueOfPreviousUuid = null;
var _nextIntraMillisecondIncrement = 0;
var _cachedMillisecondsBetween1582and1970 = null;
var _cachedHundredNanosecondIntervalsPerMillisecond = null;
var _uniformNode = null;
// --------------------------------------------------
// Private constants:
var HEX_RADIX = 16;
function _carry(/* array */ arrayA) {
// summary:
// Given an array which holds a 64-bit number broken into 4 16-bit
// elements, this method carries any excess bits (greater than 16-bits)
// from each array element into the next.
// arrayA: An array with 4 elements, each of which is a 16-bit number.
arrayA[2] += arrayA[3] >>> 16;
arrayA[3] &= 0xFFFF;
arrayA[1] += arrayA[2] >>> 16;
arrayA[2] &= 0xFFFF;
arrayA[0] += arrayA[1] >>> 16;
arrayA[1] &= 0xFFFF;
dojo.lang.assert((arrayA[0] >>> 16) === 0);
}
function _get64bitArrayFromFloat(/* float */ x) {
// summary:
// Given a floating point number, this method returns an array which
// holds a 64-bit number broken into 4 16-bit elements.
var result = new Array(0, 0, 0, 0);
result[3] = x % 0x10000;
x -= result[3];
后面还有 295 行代码,购买后查看完整代码
24 小时内免费解锁 3 个项目,之后 1 算力/个。 规则说明
AI 解读 AI
登录后可用,每次 10 算力,解读结果公开显示在下面。
还没有人解读过这个文件。