在redis取得当前时的方法为执行time命令

127.0.0.1:6382> time
1) "1495780564"
2) "894089"

第一行为以 UNIX 时间戳格式表示已经过去的秒数

第二行为当前这一秒已经过去的微秒数

所以如果你想获得当前已经过去的总的微秒数(当前时间戳),可以执行如下:

EVAL "local a=redis.call('TIME') ;return a[1]*1000000+a[2] " 0

127.0.0.1:6382> EVAL "local a=redis.call('TIME') ;return a[1]*1000000+a[2] " 0
(integer) 1495789058464908
127.0.0.1:6382> EVAL "local a=redis.call('TIME') ;return a[1]*1000000+a[2] " 0
(integer) 1495789059168013
127.0.0.1:6382> EVAL "local a=redis.call('TIME') ;return a[1]*1000000+a[2] " 0
(integer) 1495789059753398
127.0.0.1:6382> EVAL "local a=redis.call('TIME') ;return a[1]*1000000+a[2] " 0
(integer) 1495789060401989
127.0.0.1:6382> EVAL "local a=redis.call('TIME') ;return a[1]*1000000+a[2] " 0
(integer) 1495789061097167

----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

redis获取当前时间精确到微秒的更多相关文章

  1. PHP——获取当前时间精确到毫秒(yyyyMMddHHmmssSSS)

    前言 emmmmmm,别说话,我们偷偷偷狗子 格式 | yyyyMMddHHmmssSSS 代码 获取毫秒 //获取当前时间毫秒 function msectime() { list($msec, $ ...

  2. java获取当前时间精确到毫秒

    转载:http://af8991.iteye.com/blog/1217672 import java.text.SimpleDateFormat; import java.util.Date; im ...

  3. C/C++ 获取系统时间 到秒 || 到毫秒

    string getNowSysTime(string &outPut) { ] = {}; struct timeval tv; struct timezone tz; struct tm ...

  4. java获取当前日期时间代码总结

    1.获取当前时间,和某个时间进行比较.此时主要拿long型的时间值.  方法如下: 要使用 java.util.Date .获取当前时间的代码如下  代码如下 复制代码 Date date = new ...

  5. java学习第13天( java获取当前时间,有关大数据的运算及精确数字运算,Date类)

    一 java获取当前时间 学习一个函数,得到当前时间的准确值 System.currectTimeMillis(). 可以得到以毫秒为单位的当前时间.它主要用于计算程序运行时间,long start= ...

  6. VC++ 获取系统时间、程序运行时间(精确到秒,毫秒)的五种方法

    1.使用CTime类(获取系统当前时间,精确到秒) CString str; //获取系统时间 CTime tm; tm=CTime::GetCurrentTime();//获取系统日期 str=tm ...

  7. 【VS开发】VC++ 获取系统时间、程序运行时间(精确到秒,毫秒)的五种方法

    1.使用CTime类(获取系统当前时间,精确到秒) CString str; //获取系统时间 CTime tm; tm=CTime::GetCurrentTime();//获取系统日期 str=tm ...

  8. redis基本操作,基于StringRedisTemplate,存储,取值,设置超时时间,获取超时时间,插入list操作

    @Autowired private StringRedisTemplate stringRedisTemplate; @GetMapping("/test") void test ...

  9. C# 版本的 计时器类:精确到微秒 秒后保留一位小数 支持年月日时分秒带单位的输出

    class TimeCount { // 临时变量,存放当前类能表示的最大年份值 ; /// <summary> /// 获取毫秒能表示的最大年份数 /// </summary> ...

随机推荐

  1. 如何在 Mac 上通过 Boot Camp 安装 Windows?

    如何在 Mac 上通过 Boot Camp 安装 Windows? The following contents are chosen from the apple website, thanks f ...

  2. activiti主要API对象

    ProcessEngine         //流程引擎 RuntimeService      //与流程实例,执行对象(正在执行) TaskService           //正在执行任务 H ...

  3. Android 7.0 介绍和适配问题

    介绍:http://gank.io/post/56e0b83c67765963436fcb94 适配:http://blog.csdn.net/fengyuzhengfan/article/detai ...

  4. Cocos2d-x 源代码分析 : Scheduler(定时器) 源代码分析

    源代码版本号 3.1r,转载请注明 我也最终不out了,開始看3.x的源代码了.此时此刻的心情仅仅能是wtf! !!!!!!! !.只是也最终告别CC时代了. cocos2d-x 源代码分析文件夹 h ...

  5. Objective-C 位运算符

    转自:http://www.yiibai.com/objective_c/objective_c_bitwise_operators.html 下表中列出了支持Objective-C语言的位运算符.假 ...

  6. express应用中常用中间件介绍

    var strftime = require('strftime'); 时间格式化中间件,功能和moment.js差不多 var methodOverride = require('method-ov ...

  7. Java中的异常处理:何时抛出异常,何时捕获异常,何时处理异常?

    Java中的异常处理:何时抛出异常,何时捕获异常? 2017-06-07 1 异常分类 Throwable对象可以分为两组: 一组是unchecked异常,异常处理机制往往不用于这组异常,包括: Er ...

  8. Lintcode: Implement Queue by Stacks 解题报告

    Implement Queue by Stacks 原题链接 : http://lintcode.com/zh-cn/problem/implement-queue-by-stacks/# As th ...

  9. 【Python学习笔记】-冒泡排序、插入排序、二分法查找

    原文出处:https://blog.csdn.net/yort2016/article/details/68065728 冒泡排序 主要是拿一个数与列表中所有的数进行比对,若比此数大(或者小),就交换 ...

  10. 【Python】打印object对象

    print (object .__dict__) print (dir(object))