cocos2dx 3.1获取系统当前时间
std::string Tools::getcurrTime() { #if (CC_TARGET_PLATFORM == CC_PLATFORM_ANDROID || CC_TARGET_PLATFORM == CC_PLATFORM_IOS) struct timeval now; struct tm* time; gettimeofday(&now, NULL); time = localtime(&now.tv_sec); ; log("year = %d",year); ] = {}; sprintf(date, ,(,(int)time->tm_mday); log("%s",date); return StringUtils::format("%s",date); #endif #if ( CC_TARGET_PLATFORM == CC_PLATFORM_WIN32 ) struct tm* tm; time_t timep; time(timep); tm = localtime(&timep); ] = {}; sprintf(date, ,(,(int)time->tm_mday); log("%s",date); return StringUtils::format("%s",date); #endif }
以上是获取当前年月日
---------------------------------详解的其他方法
linux,ios下的
struct cc_timeval now; CCTime::gettimeofdayCocos2d(&now, NULL); struct tm *tm; tm = localtime(&now.tv_sec); ; ; int day = tm->tm_mday; int hour=tm->tm_hour; int minute=tm->tm_min; int second=tm->tm_sec; + now.tv_usec / ;
win32下
struct tm *tm; time_t timep; time(&timep); tm = localtime(&timep); ; ; int day = tm->tm_mday; int hour=tm->tm_hour; int minute=tm->tm_min; int second=tm->tm_sec;
cocos2dx 3.1获取系统当前时间的更多相关文章
- java获取系统指定时间年月日
java获取系统指定时间年月日 private String setDateTime(String falg) { Calendar c = Calendar.getInstance(); c.set ...
- Unity3D获取系统当前时间,并格式化显示
Unity 获取系统当前时间,并格式化显示.通过“System.DateTime”获取系统当前的时间,然后通过格式化把获得的时间格式化显示出来,具体如下: 1.打开Unity,新建一个空工程,Unit ...
- Oracle,MySQL,sqlserver三大数据库如何获取系统当前时间
Oracle中如何获取系统当前时间:用SYSDATE() MySQL中获取系统当前时间主要有以下几点: (1)now()函数以('YYYY-MM-dd HH:mm:SS')返回当前的日期时间,可以直接 ...
- java 获取系统当前时间并格式化
java 获取系统当前时间并格式化 CreateTime--2018年5月9日11:41:00 Author:Marydon 实现方式有三种 updateTime--2018年7月23日09点32 ...
- 使用js时,如何获取系统当前时间并且得到格式为"yyyy年MM月"的日期
1.使用js时,如何获取系统当前时间并且得到格式为"yyyy年MM月"的日期: 1 var newdate = new Date(); 2 var nowyear = newdat ...
- C++ 获取系统当前时间(日历时)
获取系统当前时间(日历时) //Linux & C++11 #include <chrono> #include <ctime> using namespace std ...
- android service 样例(电话录音和获取系统当前时间)
关于android service 的具体解释请參考: android四大组件--android service具体解释.以下将用两个实例具体呈现Android Service的两种实现. 一个是st ...
- C# 获取系统开机时间
原文:C# 获取系统开机时间 /// /// 获取系统开机时间 /// /// private DateTime GetComput ...
- C/C++获取系统当前时间
C/C++获取系统当前时间 C库中与系统时间相关的函数定义在<time.h>头文件中, C++定义在<ctime>头文件中. 一.time(time_t*)函数 函数定义如 ...
随机推荐
- WAV文件头相关资料
http://stackoverflow.com/questions/6284651/avaudiorecorder-doesnt-write-out-proper-wav-file-header h ...
- JAVA NIO——Buffer和FileChannel
Java NIO和IO的主要区别 IO NIO 面向流 面向缓冲 阻塞IO 非阻塞IO 无 选择器 示例: import java.io.FileInputStream; import java.io ...
- iOS · UILabel加删除线
创建自定义子类DeleteLineLabel,继承自UILabel,然后在自定义子类DeleteLineLabel中 方法一(上下文): - (void)drawRect:(CGRect)rect { ...
- 判断checkbox是否选中
一种是通过jquery A. $("[name='selectUserId']:checked").each(function () { // $(this).attr(" ...
- 【转】Source Insight的Alt + W键不能使用的解决办法
转载地址:http://velep.com/archives/607.html 对于Source Insight 3.5,习惯于使用Alt + W组合键并配合数字键来切换文件窗口,带来无比的便利.但是 ...
- html热力图的操作(点击图片的不同位置操作不同的事件)适合说明文档
页面核心代码 <div class="first_top"> <div class="back"> <img src=" ...
- 一个简单的loading,纯属自娱自乐
/// <reference path="/scripts/js/jquery.min.js" /> var zsw = { loading: function (im ...
- Java开发中经典的小实例-(冒泡法)
public class Test25 { public static void main(String[] args) { // 冒泡法 int[] array = ...
- 29.Hadoop之HDFS集群搭建笔记
0.修改IP,主机名,hosts文件 setup 修改网卡IP service network restart 重启网络服务使IP生效 ...
- windows PHONE 开发-入门程序构筑
1:页面的扩展名为:.xaml文件类似于ASPX一样可以编写客户端显示内容和后台处理内容 一般的前台页面的形式为: <Page x:Class="MyFirstApp.MainPage ...