在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. linux(centos6)搭建ftp服务器 -摘自网络

    前提 ssh服务已经开启,关闭防火墙,主机和虚拟机能ping通 查看ssh和防火墙的状态 service sshd status service iptables status 开启ssh服务 ser ...

  2. Android 消息分发机制

    Android 中针对耗时的操作,放在主线程操作,轻者会造成 UI 卡顿,重则会直接无响应,造成 Force Close.同时在 Android 3.0 以后,禁止在主线程进行网络请求. 针对耗时或者 ...

  3. char型指针和字符串字面量和字符数组

    1.当一个char型指针指向一个字符串字面量(也就是常量字符串)时,该指针必须由const修饰,否则,系统会给出deprecated(不赞成)的警告.原因是:字符串字面量不可改变,当它被一个非cons ...

  4. Memory Leak检測神器--LeakCanary初探

      在之前的文章Android内存泄露的几种情形中提到过在开发中常见的内存泄露问题,可是过于草率.因为刚开年,工作还没正式展开,就看了一下Github开源大户Square的LeakCanary,并用公 ...

  5. centos安装man中文手册

    第一步下载man中文手册压缩包 //下载 wget http://pkgs.fedoraproject.org/repo/pkgs/man-pages-zh-CN/manpages-zh-1.5.1. ...

  6. 解决myeclipse/eclipse创建或导入maven工程时引发的问题

    起因: 最近学习maven,按照教程把命令行创建的maven工程导入到eclipse/myeclipse,由于库中没有一些依赖包,所以在导入工程的时候开发工具自动下载依赖包.可是,由于天朝特殊环境的问 ...

  7. [Windows Azure] Walkthrough to Configure System Center Management Pack for Windows Azure Fabric Preview for SCOM 2012 SP1 (with a MetricsHub Bonus)

    The wait is finally over. This is a huge update to the Azure Management Pack over the one that was r ...

  8. [iOS Xcode8报错]dyld: Library not loaded: /System/Library/Frameworks/UserNotifications.framework/UserN

    [iOS Xcode8报错]dyld: Library not loaded: /System/Library/Frameworks/UserNotifications.framework/UserN ...

  9. Lua中的loadfile,dofile,require使用,最后还有调试

    1.loadfile---只编译,不运行. loadfile编译代码成中间码并且返回编译后的chunk作为一个函数,而不执行代码:另外loadfile不会抛出错误信息而是返回错误代号. loadstr ...

  10. hive外部表删除遇到的一个坑

    hive外部表删除遇到的一个坑 操作步骤 创建某个表(create external table xxx location xxx) 插入数据(insert xxx select xxx from x ...