//得到系统时间
CCString* HelloWorld::getSystemTime()
{
struct tm *tm;
#if (CC_TARGET_PLATFORM == CC_PLATFORM_WIN32)
//win32平台
time_t timep;
time(&timep);
tm = localtime(&timep);
#else
//android、ios平台
struct cc_timeval now;
CCTime::gettimeofdayCocos2d(&now, NULL);
tm = localtime(&now.tv_sec);
#endif
int year = tm->tm_year + 1900;
int month = tm->tm_mon + 1;
int day = tm->tm_mday;
int hour=tm->tm_hour;
int min=tm->tm_min;
CCString *string=CCString::createWithFormat("%d-%d-%d %d:%d",year,month,day,hour,min);
return string;
}相关推荐
Electron多窗口开发避坑指南:Pinia状态同步的3种解决方案对比
本文深入探讨了在Electron多窗口应用中实现Pinia状态同步的三种核心方案。针对Electron多窗口架构下状态隔离的挑战,文章对比了基础事件通信、共享存储以及智能Pinia插件等方案的优劣与适用场景,并提供了生产级的实现指南与选型建议,帮助开发者构建健壮高效的桌面应用。
cocos2dx获取系统当前时间
#if (CC_TARGET_PLATFORM == CC_PLATFORM_ANDROID || CC_TARGET_PLATFORM == CC_PLATFORM_IOS) struct timeval now; struct tm* time; gettimeofday(&now, NULL); time = localtime(&...
Elsevier期刊LaTeX双栏模板(cas-dc)实战:从Overleaf配置到投稿全流程
本文详细介绍了Elsevier期刊LaTeX双栏模板(cas-dc)在Overleaf平台上的配置与使用全流程,包括模板结构解析、标题与作者信息规范、摘要与关键词特殊格式、正文写作技巧、参考文献管理以及投稿前检查清单。特别针对Elsevier期刊投稿需求,提供了从模板安装到最终投稿的实用指南,帮助研究者高效完成论文排版工作。
cocos2d-x获取系统时间
用cocos2d-x获取系统时间,格式为年月日时分秒: void GetTime(float dt) { struct tm *tm; #if (CC_TARGET_PLATFORM == CC_PLATFORM_WIN32) //win32平台 time_t timep; time(&timep); tm = localti
GPS从入门到放弃(一) --- GPS基础原理
GPS从入门到放弃(一) — GPS基础原理 GPS,全称Global Positioning System,已经广泛应用于我们的日常生活中了,现在的智能手机 里都会自带GPS定位功能。这是一个美国的全球定位系统,虽然我们现在也有北斗了,但毕竟GPS搞的早,所以先从它开始研究起。 整个GPS系统分三大部分: 地面站 卫星 接收机 地面站负责监控。它们通过接收、测量各个卫星信号,计算卫星的运行轨...
链路监控pinpoint3.0.3安装部署(2)
本文详细介绍了Pinpoint 3.0.3分布式链路监控系统的安装部署过程。主要内容包括:1)数据库安装(HBase、MySQL、Redis、Pinot)的详细配置步骤;2)中间件Zookeeper和Kafka的安装;3)Pinpoint三大组件的部署:Collector、Web和Batch的配置文件修改和启动脚本。文章特别强调了使用-starter-exec.jar包的重要性,并提供了各组件所需的详细参数配置,包括数据库连接、Zookeeper地址、Kafka配置等关键信息。
【总结】Cocos2d-x实用方法整理
本篇整理学习过程中用到的一些小技巧,以便之后使用,后续不断补充。
Linux系统搭建OpenClaw(原Clawdbot)全流程指南 最新版
工具定位:开源个人 AI 助手,支持文件读取、命令执行、多渠道交互(Telegram / 本地终端等);系统要求:主流 Linux 发行版(Ubuntu/Debian/CentOS 等),Node.js ≥22(核心依赖);安全提示:OpenClaw 为测试版,具备高权限操作能力,建议使用非主力机,配置权限白名单,避免接触敏感数据。
cocos2d-x之闹钟篇
这几天不忙,终于可以学习了 写了个闹钟 跟大家分享下 struct cc_timeval now; CCTime::gettimeofdayCocos2d(&now, NULL); struct tm * tm; tm = localtime(&now.tv_sec); nHour = tm->tm_hour; nMinute
前言:关于作者吴秋生博士与此书简介
博士现为田纳西大学,诺克斯维尔分校,地理系的副教授。他的研究兴趣包括地理信息科学(GIS)、遥感和环境建模。更具体地说,对应用地理空间大数据、机器学习和云计算(例如,谷歌地球引擎、微软行星计算机)来研究环境变化,特别是地表水和湿地淹没动态。吴博士是开放科学和可重复研究的倡导者。他开发了几个用于高级地理空间分析的开源软件包(例如,吴博士还在YouTube上发布了数百个有关GIS和地图绘制的视频。更多有关他的开源项目信息,请访问GitHub(查看他的YouTube频道。.....................
LAMMPS-使用MATLAB计算径向分布函数
首先需要使用LAMMPS进行分子动力学模拟,并获取到所需的数据文件,LAMMPS是一款开源的分子动力学模拟软件,可以模拟原子、分子和离子的运动行为,对于本文的目标假设你已经完成了LAMMPS的安装和模拟过程,获得了数据文件。)是一种重要的统计工具,用于描述原子或分子之间的空间分布情况,通过计算RDF可以获得物质的结构信息、相互作用距离以及相位转变等重要参数,本文将介绍如何使用MATLAB计算LAMMPS生成的数据文件的径向分布函数。变量替换为你的实际数据文件的名称。
【cocos2dx】android编译之ctime:66: error: ‘::clock_t’ has not been declared
编译android 报错,ctime:66: error: ‘::clock_t’ has not been declared,诡异的问题如下图: 报一个gnu的C++标准库的ctime的错误 程序中根本木有调用<ctime>,那这个诡异的问题是怎么来的呢? 后来发现我有一个类Time.h和Time.cpp,对就是这货,且不管为什么GNU为什么不识别大小写,为什么和标准库...
TMS_WebGMaps_1.9.8.0_Full_Source
TMS_WebGMaps_1.9.8.0_Full_Source 全源码 delphi cbuilder
Cocos2d-x 获取系统当前时间
在项目中我们常常需要获取系统当前时间,用作随机数的种子或者将当前时间显示到画面中。 在标准C/C++中,我们通常使用tm结构实现对系统当前时间的获取。头文件time.h中定义如下:在标准C/C++中,我们可通过tm结构来获得日期和时间,tm结构在time.h中的定义如下: #ifndef _TM_DEFINED struct tm { int tm_sec; /* 秒 – 取值区间为[0,
深度学习工具包 DeepLearningToolbox
深度学习工具包Deprecation notice.-----This toolbox is outdated and no longer maintained.There are much better tools available for deep learning than this toolbox, e.g. [Theano](http://deeplearning.net/software/theano/), [torch](http://torch.ch/) or [tensorflow](http://www.tensorflow.org/)I would suggest you use one of the tools mentioned above rather than use this toolbox.Best, Rasmus.DeepLearnToolbox================A Matlab toolbox for Deep Learning.Deep Learning is a new subfield of machine learning that focuses on learning deep hierarchical models of data.It is inspired by the human brain's apparent deep (layered, hierarchical) architecture.A good overview of the theory of Deep Learning theory is[Learning Deep Architectures for AI](http://www.iro.umontreal.ca/~bengioy/papers/ftml_book.pdf)For a more informal introduction, see the following videos by Geoffrey Hinton and Andrew Ng.* [The Next Generation of Neural Networks](http://www.youtube.com/watch?v=AyzOUbkUf3M) (Hinton, 2007)* [Recent Developments in Deep Learning](http://www.youtube.com/watch?v=VdIURAu1-aU) (Hinton, 2010)* [Unsupervised Feature Learning and Deep Learning](http://www.youtube.com/watch?v=ZmNOAtZIgIk) (Ng, 2011)If you use this toolbox in your research please cite [Prediction as a candidate for learning deep hierarchical models of data](http://www2.imm.dtu.dk/pubdb/views/publication_details.php?id=6284)```@MASTERSTHESIS\{IMM2012-06284, author = "R. B. Palm", title = "Prediction as a candidate for learning deep hierarchical models of data", year = "2012",}```Contact: rasmusbergpalm at gmail dot comDirectories included in the toolbox-----------------------------------`NN/` - A library for Feedforward Backpropagation Neural Networks`CNN/` - A library for Convolutional Neural Networks`DBN/` - A library for Deep Belief Networks`SAE/` - A library for Stacked Auto-Encoders`CAE/` - A library for Convolutional Auto-Encoders`util/` - Utility functions used by the libraries`data/` - Data used by the examples`tests/` - unit tests to verify toolbox is workingFor references on each library check REFS.mdSetup-----1. Download.2. addpath(genpath('DeepLearnToolbox'));Example: Deep Belief Network---------------------```matlabfunction test_example_DBNload mnist_uint8;train_x = double(train_x) / 255;test_x = double(test_x) / 255;train_y = double(train_y);test_y = double(test_y);%% ex1 train a 100 hidden unit RBM and visualize its weightsrand('state',0)dbn.sizes = [100];opts.numepochs = 1;opts.batchsize = 100;opts.momentum = 0;opts.alpha = 1;dbn = dbnsetup(dbn, train_x, opts);dbn = dbntrain(dbn, train_x, opts);figure; visualize(dbn.rbm{1}.W'); % Visualize the RBM weights%% ex2 train a 100-100 hidden unit DBN and use its weights to initialize a NNrand('state',0)%train dbndbn.sizes = [100 100];opts.numepochs = 1;opts.batchsize = 100;opts.momentum = 0;opts.alpha = 1;dbn = dbnsetup(dbn, train_x, opts);dbn = dbntrain(dbn, train_x, opts);%unfold dbn to nnnn = dbnunfoldtonn(dbn, 10);nn.activation_function = 'sigm';%train nnopts.numepochs = 1;opts.batchsize = 100;nn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.10, 'Too big error');```Example: Stacked Auto-Encoders---------------------```matlabfunction test_example_SAEload mnist_uint8;train_x = double(train_x)/255;test_x = double(test_x)/255;train_y = double(train_y);test_y = double(test_y);%% ex1 train a 100 hidden unit SDAE and use it to initialize a FFNN% Setup and train a stacked denoising autoencoder (SDAE)rand('state',0)sae = saesetup([784 100]);sae.ae{1}.activation_function = 'sigm';sae.ae{1}.learningRate = 1;sae.ae{1}.inputZeroMaskedFraction = 0.5;opts.numepochs = 1;opts.batchsize = 100;sae = saetrain(sae, train_x, opts);visualize(sae.ae{1}.W{1}(:,2:end)')% Use the SDAE to initialize a FFNNnn = nnsetup([784 100 10]);nn.activation_function = 'sigm';nn.learningRate = 1;nn.W{1} = sae.ae{1}.W{1};% Train the FFNNopts.numepochs = 1;opts.batchsize = 100;nn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.16, 'Too big error');```Example: Convolutional Neural Nets---------------------```matlabfunction test_example_CNNload mnist_uint8;train_x = double(reshape(train_x',28,28,60000))/255;test_x = double(reshape(test_x',28,28,10000))/255;train_y = double(train_y');test_y = double(test_y');%% ex1 Train a 6c-2s-12c-2s Convolutional neural network %will run 1 epoch in about 200 second and get around 11% error. %With 100 epochs you'll get around 1.2% errorrand('state',0)cnn.layers = { struct('type', 'i') %input layer struct('type', 'c', 'outputmaps', 6, 'kernelsize', 5) %convolution layer struct('type', 's', 'scale', 2) %sub sampling layer struct('type', 'c', 'outputmaps', 12, 'kernelsize', 5) %convolution layer struct('type', 's', 'scale', 2) %subsampling layer};cnn = cnnsetup(cnn, train_x, train_y);opts.alpha = 1;opts.batchsize = 50;opts.numepochs = 1;cnn = cnntrain(cnn, train_x, train_y, opts);[er, bad] = cnntest(cnn, test_x, test_y);%plot mean squared errorfigure; plot(cnn.rL);assert(er<0.12, 'Too big error');```Example: Neural Networks---------------------```matlabfunction test_example_NNload mnist_uint8;train_x = double(train_x) / 255;test_x = double(test_x) / 255;train_y = double(train_y);test_y = double(test_y);% normalize[train_x, mu, sigma] = zscore(train_x);test_x = normalize(test_x, mu, sigma);%% ex1 vanilla neural netrand('state',0)nn = nnsetup([784 100 10]);opts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samples[nn, L] = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.08, 'Too big error');%% ex2 neural net with L2 weight decayrand('state',0)nn = nnsetup([784 100 10]);nn.weightPenaltyL2 = 1e-4; % L2 weight decayopts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex3 neural net with dropoutrand('state',0)nn = nnsetup([784 100 10]);nn.dropoutFraction = 0.5; % Dropout fraction opts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex4 neural net with sigmoid activation functionrand('state',0)nn = nnsetup([784 100 10]);nn.activation_function = 'sigm'; % Sigmoid activation functionnn.learningRate = 1; % Sigm require a lower learning rateopts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex5 plotting functionalityrand('state',0)nn = nnsetup([784 20 10]);opts.numepochs = 5; % Number of full sweeps through datann.output = 'softmax'; % use softmax outputopts.batchsize = 1000; % Take a mean gradient step over this many samplesopts.plot = 1; % enable plottingnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex6 neural net with sigmoid activation and plotting of validation and training error% split training data into training and validation datavx = train_x(1:10000,:);tx = train_x(10001:end,:);vy = train_y(1:10000,:);ty = train_y(10001:end,:);rand('state',0)nn = nnsetup([784 20 10]); nn.output = 'softmax'; % use softmax outputopts.numepochs = 5; % Number of full sweeps through dataopts.batchsize = 1000; % Take a mean gradient step over this many samplesopts.plot = 1; % enable plottingnn = nntrain(nn, tx, ty, opts, vx, vy); % nntrain takes validation set as last two arguments (optionally)[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');```[](https://bitdeli.com/free "Bitdeli Badge")
pscad IEEE标准系统搭建说明
pscad IEEE标准系统搭建说明,包含典型的IEEE 9节点、14节点、30节点、39节点和118节点系统。内含标准测试系统的原始数据和潮流结果。
cocos2d-x 系统时间获取和格式化
//1、获取系统时间毫秒数 double HelloWorld::getTimeDouble() { time_t timep; //注:time_t 实际上是长整形 #if (CC_TARGET_PLATFORM == CC_PLATFORM_WIN32) time(&timep); #else struct cc_timeval now;
复分析 阿尔福斯(Ahlfors) 第三版答案 英文
答案分为十章,有部分习题没有答案,全英文复分析阿尔福斯(Ahlfors) 第三版答案
cocos2d-x获取系统时间 CCTime::gettimeofdayCocos2d
欢迎转载,本帖地址:http://blog.csdn.net/jinjian2009/article/details/9449585 之前使用过cocos2d-x获取系统时间,毫秒级的 [cpp] view plaincopy long getCurrentTime() { struct timeval t
cocos2d-x 获取系统时间 年月日时分秒还有毫秒
系统时间
Cocos2d-x 获取系统毫秒时间
原文链接:http://4137613.blog.51cto.com/4127613/760652 因为最近在写一个炸弹人例子,用双击控制布雷。 但是突然发现知易的教程中使用的是 UITouch 类,这个类是 iOS 的。因此在 cocos2d 中无法使用。 因此只能自己手动判断两次单击之间的时间间隔,以此来确定双击。 所以,我们需要获得系统时间,本来想用标准 C 里面的 time,
cocos2d-x之系统时间和随机数
随机数是我们在程序中经常要用到的,cocos2d-x用CCRANDOM_0_1产生随机数,但我们最后给它传入一个随机数种子,这样产生的随机数才是真正的随机数,而这个种子就是我们一般使用的时间。下面通过代码看看我们如何实现。 [cpp collapse="false"]bool HelloWorld::init(){ bool bRet = false; do { CC_BREAK_IF(!
Cocos2d-x 获取系统时间
long NetWorkManager::currentTimeNow() { struct cc_timeval now; CCTime::gettimeofdayCocos2d(&now, NULL); struct tm *tm; tm = localtime(&now.tv_sec); int year = tm->tm_year + 1
Cocos2d-x中获取系统时间
在Cocos2d-x中,有时需要获取当前系统的时间。 方法如下:time_t t = time(NULL);//创建time_t变量并初始化 tm* lt = localtime(&t);//创建tm*变量,将其指向localtime log("%d", lt->tm_hour);//显示现在小时 log("%d", lt->tm_min);//显示现在分钟 log("%d", lt->tm_s
cocos2d-x下获取系统的当前时间
cocos2d-x下获取系统的当前时间 struct tm *tm; time_t timep; time(&timep); tm = localtime(&timep); int year = tm->tm_year + 1900; int month = tm->tm_mon + 1; int day = tm->tm_mday; int hour = t
cocos2d-x 获取当前时间
cocos2d-x 获取当前时间 2013-07-03 15:58:02| 分类: cocos2d-x | 标签: |字号大中小 订阅 来自:http://bbs.firedragonpzy.com.cn/forum.php?mod=viewthread&tid=101&extra=page%3D1 long int Common
481



被折叠的 条评论
为什么被折叠?



