You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

40 lines
831 B

namespace Sog
{
/*
64-57 8b inst id
56-49 8b server type
48-17 32b time
16-1 16b seq = 65536
*/
//这个算法没法保证全业务id唯一,作废了 zouwei 20220721
/*
public class UniqueIDMgr
{
public readonly uint UID_START_TIME = 1645459200; //2022/2/22
private ulong baseUUid;
private ulong timeGap;
private ulong uuid;
public UniqueIDMgr(uint serverType, uint instId)
{
timeGap = (ulong)(AppTime.GetNowSysSecond() - UID_START_TIME);
baseUUid = ((ulong)instId << 56) | ((ulong)serverType << 48) | (timeGap << 16);
uuid = baseUUid;
}
public ulong GenUniqueId()
{
uuid++;
return uuid;
}
}
*/
}