• 第二十五章补充内容 18区域差异 简单


    // 第二十五章补充内容 18区域差异
    // 1 语言
    // 2 货币表示
    // 3 字符
    // 4 字符集
    // 5 时间表示的不同
    
    //18.1 locale类
    //为了解决地区差异,C++为我们提供了一个locale类
    
    //18.2 默认区域表示或全局区域表示
    
    //18.3 时间与地理设置
    //1 time返回系统当前的日历时间
    //该函数需要头文件time.h
    //time_t time(time_t *time)
    /*#include <time.h>
    #include <iostream>
    using namespace std;
    int main()
    {
        struct tm *ptr;
    	time_t t;
    	t = time(NULL);
    	ptr = localtime(&t);
    	cout<<asctime(ptr);
    	return 0;
    }*/
    
    //2 localtime()返回指向当前时间的指针
    // struct tm *localtime(const time_t *time)
    /*#include <iostream>
    #include <time.h>
    using namespace std;
    int main()
    {
    	struct tm *local;
    	time_t t;
    	t = time(NULL);
    	local = localtime(&t);
    	cout<<"本地时间日期:"<<asctime(local);
        return 0;
    }*/
    
    //3 asctime()时间文本格式
    //char *asctime(const struct tm *ptr)
    /*#include <iostream>
    #include <time.h>
    using namespace std;
    int main()
    {
       struct tm *ptr;
       time_t t;
       t = time(NULL);
       ptr = localtime(&t);
       cout<<asctime(ptr);
       return 0;
    }*/
    
    //4 clock()返回自程序开始运行所经过的时间
    //clock_t clock(void)
    /*#include <iostream>
    #include <time.h>
    using namespace std;
    void Rtime()
    {
         cout<<"调用该程序所花费的时间:"<<clock()/CLOCKS_PER_SEC<<"secs"<<endl;
    }
    int main()
    {
        for(int i=0; i<10000; i++){
    	   cout<<"i:"<<i<<endl;
    	}
       Rtime();
       return 0;
    }*/
    
    
    //5 ctime()返回自程序开始运行所经过的时间
    /*#include <time.h>
    #include <iostream>
    using namespace std;
    int main()
    {
         time_t t;
    	 t = time(NULL);
    	 cout<<ctime(&t);
    	 return 0;
    }*/
    
    //6 difftime()两时刻的时隔
    //double difftime(time_t time2, time_t time1)
    /*#include <iostream>
    #include <time.h>
    using namespace std;
    int main()
    {
    	time_t start,end;
    	start = time(NULL);
    	long unsigned i;
    	for(i=0; i<900000000; i++);
    	end = time(NULL);
    	cout<<"循环使用了:"<<difftime(end,start)<<"秒"<<endl;
        return 0;
    }*/
    
    //7 gmtime()返回指向当前格林威治时间的指针
    //struct tm *gmtime(const time_t *time)
    /*#include <iostream>
    #include <time.h>
    using namespace std;
    int main()
    {
    	struct tm *local,*gl;
    	time_t t;
    	t = time(NULL);
    	local = localtime(&t);
    	cout<<"本地日期时间:"<<asctime(local)<<endl;
    	gl = gmtime(&t);
    	cout<<"格林威治时间:"<<asctime(gl)<<endl;
        return 0;
    }*/
    
    
    //8 mktime()返回指定时间的日历格式
    //time_t mktime(struct tm *time)
    

      

  • 相关阅读:
    语音识别六十年
    神经网络架构PYTORCH-几个概念
    Ubuntu 16.04 系统无法挂载u盘的问题
    技术的止境
    神经网络架构PYTORCH-宏观分析
    Python中parameters与argument区别
    神经网络架构PYTORCH-初相识(3W)
    【ES】学习9-聚合2
    【ES】学习8-聚合1
    【python】中文提取,判断,分词
  • 原文地址:https://www.cnblogs.com/xiangxiaodong/p/2725109.html
Copyright © 2020-2023  润新知