# moth-sequence **Repository Path**: tuzhe/moth-sequence ## Basic Information - **Project Name**: moth-sequence - **Description**: 分布式 ID 生成算法,目前只有 twitter 的 snowflake 算法 - **Primary Language**: Java - **License**: GPL-2.0 - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 8 - **Forks**: 0 - **Created**: 2017-07-26 - **Last Updated**: 2025-07-28 ## Categories & Tags **Categories**: distributed-service **Tags**: None ## README #moth-sequence 分布式 ID 生成算法,目前只有 twitter 的 snowflake 算法 在获取系统毫秒时,每次调用 native 方法, 有一定的性能问题, 为了解决这个问题,可以后台更新此毫秒,调用时从内存中读取毫秒 /** * Returns the current time in milliseconds. Note that * while the unit of time of the return value is a millisecond, * the granularity of the value depends on the underlying * operating system and may be larger. For example, many * operating systems measure time in units of tens of * milliseconds. * *

See the description of the class Date for * a discussion of slight discrepancies that may arise between * "computer time" and coordinated universal time (UTC). * * @return the difference, measured in milliseconds, between * the current time and midnight, January 1, 1970 UTC. * @see java.util.Date */ public static native long currentTimeMillis();