暂无图片
MYSQL CURRENT_TIMESTAMP 函数 返回的是TIMESTAMP类型的吗? 也有2038年的限制不?
我来答
分享
暂无图片 匿名用户
MYSQL CURRENT_TIMESTAMP 函数 返回的是TIMESTAMP类型的吗? 也有2038年的限制不?

 MYSQL CURRENT_TIMESTAMP 函数 返回的是TIMESTAMP类型的吗? 也有2038年的限制不?

我来答
添加附件
收藏
分享
问题补充
2条回答
默认
最新
CURRENT_TIMESTAMP()CURRENT_TIMESTAMPSynonyms for NOW()


NOW([fsp])

Returns the current date and time as a value in 'YYYY-MM-DD hh:mm:ss' or YYYYMMDDhhmmss format, depending on whether the function is used in string or numeric context. The value is expressed in the session time zone.

If the fsp argument is given to specify a fractional seconds precision from 0 to 6, the return value includes a fractional seconds part of that many digits.


NOW() returns a constant time that indicates the time at which the statement began to execute. (Within a stored function or trigger, NOW() returns the time at which the function or triggering statement began to execute.) This differs from the behavior for SYSDATE(), which returns the exact time at which it executes.


In addition, the SET TIMESTAMP statement affects the value returned by NOW() but not by SYSDATE(). This means that timestamp settings in the binary log have no effect on invocations of SYSDATE(). Setting the timestamp to a nonzero value causes each subsequent invocation of NOW() to return that value. Setting the timestamp to zero cancels this effect so that NOW() once again returns the current date and time.

暂无图片 评论
暂无图片 有用 0

哎! NOW() 函数实现 不太好找, 我找到NDB的实现

#ifdef NDB_MUTEX_STAT static inline Uint64 now() { struct timespec ts; clock_gettime(CLOCK_MONOTONIC, &ts); return ts.tv_sec * 1000000000ULL + ts.tv_nsec; }

BOOST

#ifndef NGS_CHRONO_H_ #define NGS_CHRONO_H_ #include <boost/date_time/posix_time/posix_time.hpp> namespace ngs { namespace chrono { using boost::posix_time::milliseconds; using boost::posix_time::seconds; typedef boost::posix_time::ptime time_point; typedef boost::posix_time::time_duration duration; inline time_point now() { return boost::posix_time::microsec_clock::universal_time(); }

不知道对不对 源码菜鸟

暂无图片 评论
暂无图片 有用 0
回答交流
提交
问题信息
请登录之后查看
邀请回答
暂无人订阅该标签,敬请期待~~
暂无图片墨值悬赏