Exemplo n.º 1
0
        /// <summary>
        /// 转换为秒
        /// </summary>
        /// <param name="value"></param>
        /// <param name="number"></param>
        /// <returns></returns>
        public static long toSeconds(this TimeUnit value, long number)
        {
            double microsToSeconds = 1 / 1000d;//1毫秒=1秒

            return(LongHelper.SaturatedMultiply(Convert.ToInt64(Convert.ToDouble(value) * microsToSeconds), number));
        }
Exemplo n.º 2
0
        /// <summary>
        /// 转换为微秒
        /// </summary>
        /// <param name="value"></param>
        /// <param name="number"></param>
        /// <returns></returns>
        public static long toMicros(this TimeUnit value, long number)
        {
            int microsToMicro = 10000;//1毫秒=10000微秒

            return(LongHelper.SaturatedMultiply(Convert.ToInt32(value) * microsToMicro, number));
        }