类库: vc下如何按照当前系统的日期、时间格式显示时间

jackson反序列化时间万能日期格式匹配集成 使用jackson的registerModule功能,注册不同日期类型的反序列化器,支持各种场景的日期格式匹配,并封装类型fastjson式的调用方式。 主入口类JSON: package xxx.util; import java.lang.reflect.Type; import java.util.List; import java.util.TimeZone; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import 阅读详情

因为公司要统一所有产品的日期、时间显示格式,要求所有程序在显示日期时间的时候,都默认使用操作系统的时间格式。所以想着封装一个基础类供大家共用。

一开始打算使用EnumDateFormatsExEx和EnumTimeFormatsEx,在win7下开发的,结果同事拿到xp下之后发现直接异常了,然后一看msdn才发现这两个api只有vista之后的操作系统才支持。

所以要改用EnumDateFormatsEx和EnumTimeFormats,但是这两个api没有最后一个PARAM,在封装的时候无法把this传递进去,那么回调就只能把返回的数据存储在全局变量中,但是全局变量的话就无法实现线程安全,怎么办呢?

于是想到了之前看到的TLS,定义如下三个变量。

__declspec(thread)	CString* _dateStr = NULL;
__declspec(thread)	CALID* _calendarID = NULL;
__declspec(thread)	CString* _timeStr = NULL;

回调直接把api返回的值存储到这三个TLS中,然后在类CDateFormatReader的构造函数中再去把他取出来,就ok了。

这样即时多个线程同时使用这个辅助类也没关系。


下面是示例代码:

示例代码如下:

voidCTestGetSystemDateTimeFormatDlg::OnBnClickedBtnGetLongdateformat()
{  
    COleDateTimecurrentTime =COleDateTime::GetCurrentTime();
    CStringstrDate, msg;
    strDate =currentTime.Format(CDateTimeFormatStringReader::GetLongDateFormat());
    msg.Format(_T("format:%s, \nvalue: %s"),CDateTimeFormatStringReader::GetLongDateFormat(), strDate);
    AfxMessageBox(msg);
}
 
 
voidCTestGetSystemDateTimeFormatDlg::OnBnClickedBtnGetLongtimeformat()
{
    COleDateTimecurrentTime =COleDateTime::GetCurrentTime();
    CStringstrDate, msg;   
    strDate =currentTime.Format(CDateTimeFormatStringReader::GetLongTimeFormat());
    msg.Format(_T("format:%s, \nvalue: %s"),CDateTimeFormatStringReader::GetLongTimeFormat(), strDate);
    AfxMessageBox(msg);
}
 
 
voidCTestGetSystemDateTimeFormatDlg::OnBnClickedBtnGetLongdatetimeformat3()
{
    COleDateTimecurrentTime =COleDateTime::GetCurrentTime();
    CStringstrDate, msg;
    strDate =currentTime.Format(CDateTimeFormatStringReader::GetLongDateTimeFormat());
    msg.Format(_T("format:%s, \nvalue: %s"),CDateTimeFormatStringReader::GetLongDateTimeFormat(), strDate);
    AfxMessageBox(msg);
}
 
 
voidCTestGetSystemDateTimeFormatDlg::OnBnClickedBtnGetShortdateformat2()
{
    COleDateTimecurrentTime =COleDateTime::GetCurrentTime();
    CStringstrDate, msg;
    strDate =currentTime.Format(CDateTimeFormatStringReader::GetShortDateFormat());
    msg.Format(_T("format:%s, \nvalue: %s"),CDateTimeFormatStringReader::GetShortDateFormat(), strDate);
    AfxMessageBox(msg);
}
 
 
voidCTestGetSystemDateTimeFormatDlg::OnBnClickedBtnGetShorttimeformat2()
{
    COleDateTimecurrentTime =COleDateTime::GetCurrentTime();
    CStringstrDate, msg;
    strDate =currentTime.Format(CDateTimeFormatStringReader::GetShortTimeFormat());
    msg.Format(_T("format:%s, \nvalue: %s"),CDateTimeFormatStringReader::GetShortTimeFormat(), strDate);
    AfxMessageBox(msg);
}
 
 
voidCTestGetSystemDateTimeFormatDlg::OnBnClickedBtnGetShortdatetimeformat4()
{
    COleDateTimecurrentTime =COleDateTime::GetCurrentTime();
    CStringstrDate, msg;
    strDate =currentTime.Format(CDateTimeFormatStringReader::GetShortDateTimeFormat());
    msg.Format(_T("format:%s, \nvalue: %s"), CDateTimeFormatStringReader::GetShortDateTimeFormat(),strDate);
    AfxMessageBox(msg);
}


完整的封装类的代码如下:

DateTimeFormatStringReader.h

#pragma once

/**
* @class CLongDateTimeFormatStringReader
* @brief 获取当前操作系统的日期、时间格式
*/
class CDateTimeFormatStringReader
{
private:
	/**
	* @class CDateFormatReader
	* @brief 日期格式读取器
	*/
	class CDateFormatReader
	{
	private:
		/** 获取到的时间格式 */
		CString m_dateFormat;

		/**  CalendarID*/
		CALID m_calendarID;

		/** 是否是短日期格式 */
		bool m_isShort;

	private:
		/** 用于配合api的回调 */
		static BOOL CALLBACK EnumDateFormatsProcEx(
			__in  LPTSTR lpDateFormatString,
			__in  CALID CalendarID);
	public:
		CDateFormatReader(bool isShort = false);
	public:
		CString GetOSDateFormat(){ return m_dateFormat;};		
		CString GetDateFormat();
		CALID GetCalendarID(){ return m_calendarID;};
	};	

	/**
	* @class CTimeFormatReader
	* @brief 获取系统时间格式
	*/
	class CTimeFormatReader
	{
	private:
		/** 获取到的时间字符串 */
		CString m_timeFormat;
		/** 是否为短时间格式 */
		bool m_isShort;
	private:
		static BOOL CALLBACK EnumTimeFormatsProc(
			__in  LPTSTR lpTimeFormatString);

	public:
		CTimeFormatReader(bool isShort = false);
		CString GetOSTimeFormat(){ return m_timeFormat;};
		CString GetTimeFormat();
	};

public:
	static CString GetLongDateFormat();	
	static CString GetLongTimeFormat();
	static CString GetLongDateTimeFormat();

	static CString GetShortDateFormat();
	static CString GetShortTimeFormat();
	static CString GetShortDateTimeFormat();

	/** 短期日、长时间格式,这是推荐的格式 */
	static CString GetShortDateLongTimeFormat();
	static CString GetShortDateLongTimeFormatWithMilliSecond();

	static CALID GetCalendarId();
};


DateTimeFormatStringReader.cpp

#include "StdAfx.h"
#include "DateTimeFormatStringReader.h"


/**
* 本来打算就使用几个文件内的局部变量来存放回调函数返回的只,
* 但是这样的话就不是线程安全的了,所以改用线程局部变量来存储回调函数返回的值,这样就可以实现线程安全
*/
__declspec(thread)	CString* _dateStr = NULL;
__declspec(thread)	CALID* _calendarID = NULL;
__declspec(thread)	CString* _timeStr = NULL;

bool IsWindows7Later()
{
	OSVERSIONINFO osvi;
	ZeroMemory(&osvi, sizeof(OSVERSIONINFO));
	osvi.dwOSVersionInfoSize = sizeof(OSVERSIONINFO);
	GetVersionEx(&osvi);
	TCHAR szVersion[10] = {0};
	CString strVersion;
	strVersion.Format(_T("%d.%d"), osvi.dwMajorVersion, osvi.dwMinorVersion);
	return strVersion.Compare(_T("6.1")) >= 0;
}


CDateTimeFormatStringReader::CDateFormatReader::CDateFormatReader( bool isShort ):m_isShort(isShort)
{
	m_dateFormat = "";
	m_calendarID = 0;

	DWORD dwFlags = DATE_LONGDATE;
	if(m_isShort)
		dwFlags = DATE_SHORTDATE;	

	BOOL dwReturn = EnumDateFormatsEx(EnumDateFormatsProcEx, LOCALE_USER_DEFAULT, dwFlags);
	ASSERT(dwReturn);
	if(_dateStr != NULL)
	{
		this->m_dateFormat = *_dateStr;
		delete _dateStr;
		_dateStr = NULL;
	}
	if(_calendarID != NULL)
	{
		this->m_calendarID = *_calendarID;
		delete _calendarID;
		_calendarID = NULL;
	}		
}

BOOL CALLBACK CDateTimeFormatStringReader::CDateFormatReader::EnumDateFormatsProcEx( __in LPTSTR lpDateFormatString, __in CALID calendarID)
{	
	//把取过来的只存放在tls中,然后在后续的函数方法中去使用和释放
	//以便实现线程安全
	_dateStr = new CString(lpDateFormatString);	
	_calendarID = new CALID(calendarID);	
	return FALSE;
}

CString CDateTimeFormatStringReader::CDateFormatReader::GetDateFormat()
{
	CString formatStr = GetOSDateFormat();
	formatStr.Replace(_T("'"), _T(""));
	if(formatStr.Find(_T("yyyy"))>=0)
		formatStr.Replace(_T("yyyy"), _T("%Y"));
	if(formatStr.Find(_T("yy"))>=0)
		formatStr.Replace(_T("yy"), _T("%y"));

	if(formatStr.Find(_T("MMMM"))>=0)
		formatStr.Replace(_T("MMMM"), _T("%B"));
	else if(formatStr.Find(_T("MMM"))>=0)
		formatStr.Replace(_T("MMM"), _T("%b"));
	else if(formatStr.Find(_T("MM"))>=0)
		formatStr.Replace(_T("MM"), _T("%m"));
	else if(formatStr.Find(_T("M"))>=0)
		formatStr.Replace(_T("M"), _T("%m"));

	if(formatStr.Find(_T("dddd"))>=0)
		formatStr.Replace(_T("dddd"), _T("%A"));
	if(formatStr.Find(_T("ddd"))>=0)
		formatStr.Replace(_T("ddd"), _T("%a"));

	if(formatStr.Find(_T("dd"))>=0)
		formatStr.Replace(_T("dd"), _T("%d"));
	else if(formatStr.Find(_T("d"))>=0)
		formatStr.Replace(_T("d"), _T("%d"));

	return formatStr;
}


//////////////////////////////////////////////////////////////////////////
CDateTimeFormatStringReader::CTimeFormatReader::CTimeFormatReader(bool isShort):m_isShort(isShort)
{
	DWORD dwFlag = 0;
	bool isWin7OrLater = IsWindows7Later();
	if(isShort && isWin7OrLater)
		dwFlag |= TIME_NOSECONDS;
	BOOL dwReturn = EnumTimeFormats(EnumTimeFormatsProc, LOCALE_USER_DEFAULT, dwFlag);
	ASSERT(dwReturn);
	if(_timeStr != NULL)
	{
		this->m_timeFormat = *_timeStr;
		if(isShort && !isWin7OrLater)
			m_timeFormat.Replace(_T(":ss"), _T(""));
		delete _timeStr;
		_timeStr = NULL;
	}
}

BOOL CALLBACK CDateTimeFormatStringReader::CTimeFormatReader::EnumTimeFormatsProc( __in LPTSTR lpTimeFormatString)
{
	//把取过来的只存放在tls中,然后在后续的函数方法中去使用和释放
	//以便实现线程安全
	_timeStr = new CString(lpTimeFormatString);	
	return FALSE;
}

CString CDateTimeFormatStringReader::CTimeFormatReader::GetTimeFormat()
{
	CString formatStr = GetOSTimeFormat();
	if(formatStr.Find(_T("HH"))>=0)
		formatStr.Replace(_T("HH"), _T("%H"));
	else if(formatStr.Find(_T("H"))>=0)
		formatStr.Replace(_T("H"), _T("%H"));

	if(formatStr.Find(_T("hh"))>=0)
		formatStr.Replace(_T("hh"), _T("%I"));
	else if(formatStr.Find(_T("h"))>=0)
		formatStr.Replace(_T("h"), _T("%I"));

	if(formatStr.Find(_T("mm"))>=0)
		formatStr.Replace(_T("mm"), _T("%M"));
	else if(formatStr.Find(_T("m"))>=0)
		formatStr.Replace(_T("m"), _T("%M"));

	if(formatStr.Find(_T("ss"))>=0)
		formatStr.Replace(_T("ss"), _T("%S"));
	else if(formatStr.Find(_T("s"))>=0)
		formatStr.Replace(_T("s"), _T("%S"));

	if(formatStr.Find(_T("tt"))>=0)
		formatStr.Replace(_T("tt"), _T("%p"));
	return formatStr;
}

//////////////////////////////////////////////////////////////////////////
CString CDateTimeFormatStringReader::GetLongDateFormat()
{
	CDateFormatReader dateFormatReader;
	return dateFormatReader.GetDateFormat();
}

CString CDateTimeFormatStringReader::GetLongTimeFormat()
{
	CTimeFormatReader timeFormatReader;
	return timeFormatReader.GetTimeFormat();
}

CString CDateTimeFormatStringReader::GetLongDateTimeFormat()
{
	CString result;
	result.Format(_T("%s %s"), GetLongDateFormat(), GetLongTimeFormat());
	return result;
}

CString CDateTimeFormatStringReader::GetShortDateFormat()
{
	CDateFormatReader dateFormatReader(true);
	return dateFormatReader.GetDateFormat();
}

CString CDateTimeFormatStringReader::GetShortTimeFormat()
{
	CTimeFormatReader timeFormatReader(true);
	return timeFormatReader.GetTimeFormat();

}

CString CDateTimeFormatStringReader::GetShortDateTimeFormat()
{
	CString result;
	result.Format(_T("%s %s"), GetShortDateFormat(), GetShortTimeFormat());
	return result;
}

CALID CDateTimeFormatStringReader::GetCalendarId()
{
	CDateFormatReader dateFormatReader(true);
	return dateFormatReader.GetCalendarID();
}

CString CDateTimeFormatStringReader::GetShortDateLongTimeFormat()
{
	CString result;
	result.Format(_T("%s %s"), GetShortDateFormat(), GetLongTimeFormat());
	return result;
}

CString CDateTimeFormatStringReader::GetShortDateLongTimeFormatWithMilliSecond()
{
	CString result;
	result.Format(_T("%s %s"), GetShortDateFormat(), GetLongTimeFormat());
	if(result.Find(_T("%S")) >= 0)
		result.Replace(_T("%S"), _T("%S.milliSecond"));
	return result;
}


VC获取日期及时间方法 VC获取当前日期及时间的方法或函数,其中输出采用默认输出,若以一定格式输出可自行查询 立即下载

相关推荐

VC中获取当前的日期、时间并格式化输出

VC与C++开发基础;如何获取当前的日期、时间并格式化输出

VC++中CTime类format的使用

CTime类format的使用                 使用CTime类可以很方便地取得当前系统时间并转换为各种格式        The format argument consists of one or more codes; as in p

Rya的专栏 6556

VisionPro脚本实战:用C#替代QuickBuild,让复杂定位项目代码更清爽

本文探讨了如何通过C#脚本重构VisionPro复杂定位项目,替代臃肿的QuickBuild架构。通过实战案例展示了脚本化开发如何减少60%代码量并提升35%运行效率,使项目更易维护。文章详细介绍了环境搭建、多模板定位重构及高级技巧,帮助开发者突破QuickBuild限制,实现更高效的视觉应用开发。

weixin_30417487的博客 505

C/C++获取时间及时间格式转换

介绍基础概念,探讨了在C/C++中对日期和时间操作所用到的数据结构和函数,并对计时、时间的获取、时间的计算和显示格式等方面进行了阐述。本文还通过大量的实例展示了time.h头文件中声明的各种函数和数据结构的详细使用方法。

yuanjie92的专栏 3万+

深度学习模型设计的方法和技巧

设计神经网络模型是一个迭代的过程,需要不断试验和调整各个组成部分,以达到最佳性能。同时,遵循良好的工程实践,如模块化设计、版本控制、文档记录等,也是成功的关键。

xw555666的博客 4027

GOM Correlate拉伸试验后处理操作

本文描述了使用GOM Software 2022对拉伸试样进行后处理的操作,包括设置检测点、引伸计、输出应变数据到表格、输出报告为视频等

qq_45008924的博客 4666

VC不同时间格式,format:表达式字符串

format:表达式字符串 %a 星期几的简写 %A 星期几的全称 %b 月份的简写 %B 月份的全称 %c 标准的日期的时间串 %C 年份的后两位数字 %d 十进制表示的每月的第几天 %D 月/天/年 %e 在两字符域中,十进制表示的每月的第几天 %F 年-月-日 %g 年份的后两位数字,使用基于周的年 %G 年份,使用基于周的年 %h 简写的月份名 %H 24小时制

ds8750802的专栏 661

嵌入式工程师必看:BLDC电机驱动电路设计全流程(附MOS管选型指南)

本文为嵌入式工程师提供了BLDC电机驱动电路设计的全流程实战指南。文章深入解析了三相全桥逆变电路的核心原理,并重点阐述了功率MOSFET的选型关键参数,如Vds、Rds(on)和Qg。同时,详细介绍了栅极驱动设计、PCB布局布线要点及调试安全步骤,旨在帮助开发者构建稳定高效的BLDC驱动系统。

weixin_29194817的博客 590

strftime以及CTime字符函数的Format格式

%a Abbreviated weekday name%A Full weekday name%b Abbreviated month name%B Full month name%c Date and time representation appropriate for locale%d Day of month as decimal number

Ghost 1144

2025反爬终极方案:Python破解Cloudflare v2行为指纹,设备伪装+轨迹模拟拦截率压至1%

Cloudflare v2的反爬逻辑越来越接近“人类行为识别”,单纯的技术破解已失效,核心竞争力变成“模拟真实用户的能力”。本文的终极方案本质是“全方位复刻人类行为”——从设备指纹到操作轨迹,从网络特征到交互模式,让爬虫成为“无法被区分的真实用户”。这套方案的优势是“通用性强”,不仅适用于Cloudflare v2,也能破解大多数高反爬网站(如小红书、知乎、跨境电商)的行为检测;且代码可直接复用,新手只需替换目标URL和数据提取逻辑,就能快速落地。

专注于Python爬虫开发,分享爬虫技巧、项目实战与反爬经验,使用Scrapy、BeautifulSoup等工具,解决数据抓取难题。 2356

华为OD机试真题 新系统【网络数据包收发处理】

华为OD机试 新系统真题【网络数据包收发处理】,提供C语言、Java、C++、Python、Go、JavaScript源码实现,并提供完整思路讲解,以及在线OJ模拟做题。华为OD机试真题【网络数据包收发处理】多语言题解。

qq_45776114的博客 445

让编辑框动态显示系统时间

 这是一个很简单的程序设计。在你的对话框上放置一个Edit控件,要有一定的长度便于显示。给编辑框关联一个控件变量:CEdit    m_Edit1;在OnInitDialog中添加如下代码:CString strTime; CTime   tm; tm=CTime::GetCurrentTime();//获得系统时间 strTime=tm.Format("%y年%m月%d日   %

TianTangNiao232的专栏 1833

【C#程序员入门AI】必知的一些知识

2026年C#调用AI,核心就4个概念+3种方式4个概念:大模型(大脑)、嵌入(数字密码)、向量(载体)、Agent(超级助理)3种方式:云端API(快)、本地模型(隐私)、混合部署(最佳)不用怕复杂,跟着这个思路走,你就能从“AI小白”变成“C# AI开发能手”,把AI集成到你的.NET项目里,提升效率、创造价值!

人工智能AI技术 410

VC6 150个案例实战:从MFC到现代Windows开发的技能迁移与底层原理精解

Windows桌面应用开发的核心在于理解操作系统底层机制与图形用户界面框架。从Win32 API到MFC,其原理基于消息驱动与C++对象封装,为构建稳定、高效的本地应用程序提供了基础。掌握这些底层技术价值在于能够深入理解现代GUI框架(如Qt、WPF)的封装逻辑,并具备维护和现代化改造遗留系统的能力。在应用场景上,这涵盖了从工具软件、数据管理程序到嵌入式界面等广泛领域。本文聚焦于通过解析经典的Visual C++ 6.0应用案例,系统拆解MFC框架下的界面编程、文档视图架构、文件系统操作等核心模块,旨在帮助

weixin_34130389的博客 463

AutoCAD中圆弧折线化方法与实现

在AutoCAD中,圆弧折线化是将圆弧曲线转换为由一系列线段组成的折线曲线的过程。本文将介绍如何使用LISP编写代码来实现圆弧折线化,并提供相应的源代码。上述示例代码将生成一个以坐标原点为圆心、起点为(5.0, 0.0, 0.0)、终点为(0.0, 5.0, 0.0)、半径为5.0、角度为90度的圆弧的折线表示。通过使用上述的LISP代码,你可以在AutoCAD中实现将圆弧转换为折线的功能。你可以根据需要修改代码中的参数来适应不同的圆弧转换需求。函数,并传入圆弧的起点、终点、圆心、半径和角度参数。

VcuOcaml的博客 1418

lwip-2.0.3

lwip是瑞典计算机科学院(SICS)的Adam Dunkels 开发的一个小型开源的TCP/IP协议栈。实现的重点是在保持TCP协议主要功能的基础上减少对RAM 的占用。

VC format函数详解[转]

 VC format函数详解[转] Format是一个很常用,却又似乎很烦的方法,本人试图对这个方法的帮助进行一些翻译,让它有一个完整的概貌,以供大家查询之用: 首先看它的声明:function Format(const Format: string; const Args: array of const): string; overload;事实上Format方法

生命不是一场幻觉 1135

OV9734 DATASHEET,完整规格书

OV9734完整规格书,包括电气参数,尺寸规格,寄存器配置表等

VC下的时间有多钟格式

VC下的时间有多钟格式,分别罗列如下         1。标准c语言时间   time_t类型,它是以秒为单位的时间,起始时间是1970-1-1   0:0:0(GTM)     如果如果是以time_t   time(time_t   *timer)函数获取的时间     这是间是阁林尼治标准时间,需使用localtime()函数将期转化成本地时间格式     struct   tm   *lo

limi0066的专栏 9215

WINCC7.3破解文件

WINCC7.3硬件够破解文件,有需要的下载!WINCC7.3硬件够破解文件,有需要的下载!

android 蓝牙通讯demo

android 下蓝牙通讯demo,实现了发现蓝牙,使能蓝牙,通过蓝牙发送消息。

c++转换__DATE__宏为友好格式的时间和编译器预定义的宏

一边情况下,C/C++编译器会内置几个宏,这些宏定义不仅可以帮助我们完成跨平台的源码编写,灵活使用也可以巧妙地帮我们输出非常有用的调试信息。ANSI C标准中有几个标准预定义宏(也是常用的): __LINE__:在源代码中插入当前源代码行号; __FILE__:在源文件中插入当前源文件名; __DATE__:在源文件中插入当前的编译日期 __TIME__:在源文件中插入当前编译时间; _...

云守护的专栏 9463

C语言 __DATE__ - C语言零基础入门教程

C语言 __DATE__ - C语言零基础入门教程 目录 一.__DATE__简介 二.__DATE__实战 三.猜你喜欢 零基础 C/C++ 学习路线推荐 :C/C++ 学习目录>>C 语言基础入门 一.__DATE__简介 ANSIC定义了许多宏。在编程中您可以使用这些宏,但是不能直接修改这些预定义的宏。 __DATE__当前日期,一个以 “MMM DD YYYY” 格式表示的字符串常量。 __TIME__ 当前时间,一个以 “HH:MM:SS” 格式表示的...

2060

VC++获取系统当前时间并显示

VC++6.0 获取系统时间 并输入格式化字符串   CTime tm = CTime::GetCurrentTime();    CString strtm= tm.Format("%Y-%m-%d %H:%M:%S");    AfxMessageBox(strtm);   1、定义一个CTime类对象 CTime time; 2、 得到当前时间 time = CTi

xin_yu_xin的专栏 8169

C++实现同步系统时间

用C++做的同步系统时间的代码,会不断更新,以毫秒为单位。打开后自动固定到左上角,会缩到刚好能看到时间,欢迎阅读! #include<chrono> #include<ctime> #include<iostream> #include<windows.h> using namespace std::chrono; using namespace std; void gettime() { auto now=chrono::system_clock::n

m0_49484313的博客 2165

C语言和C++中几个预定义的宏:__DATE__,__TIME__,__FILE__,__LINE__

来自:C语言中文网 一边情况下,C/C++编译器会内置几个宏,这些宏定义不仅可以帮助我们完成跨平台的源码编写,灵活使用也可以巧妙地帮我们输出非常有用的调试信息。 ANSI C标准中有几个标准预定义宏(也是常用的): LINE:在源代码中插入当前源代码行号; FILE:在源文件中插入当前源文件名; DATE:在源文件中插入当前的编译日期 TIME:在源文件中插入当前编译时间; STDC:当要求程序严...

PayneZhai的博客 5278

MFC日期时间控件使用

python json与字典的相互转化

haodawei123的博客 1626

STM32物联网项目-RTC时钟

实时时钟是一个独立的定时器。RTC模块拥有一组连续计数的计数器,在相应软件配置下,可提供时钟日历的功能。修改计数器的值可以重新设置系统当前的时间和日期。RTC模块和时钟配置系统(RCC_BDCR寄存器)处于后备区域,即在系统复位或从待机模式唤醒后,RTC的设置和时间维持不变。系统复位后,对后备寄存器和RTC的访问被禁止,这是为了防止对后备区域(BKP)的意外写操作。执行以下操作将使能对后备寄存器和RTC的访问:1、设置寄存器RCC_APB1ENR的PWREN和BKPEN位,使能电源和后备接口时钟。

weixin_46251230的博客 3472

VC使用编译时间作为版本号标识

使用宏__DATE__和__TIME__ CString strVersion,strBuildTime; strBuildTime = __DATE__; strBuildTime.Append(" "); strBuildTime.Append(__TIME__); COleVariant vtime(strBuildTime); vtime.ChangeType(VT_DATE); COl

Leckun的专栏 2537

[VC] 设置系统时间

主要讲如何在VC里进行系统时间设置。 1、使用API函数SetLocalTime进行本地时间设置。1)SetLocalTime函数的原型:BOOL SetLocalTime( const SYSTEMTIME *lpSystemTime );输入参数lpSystemTime是一个SYSTEMTIME类型的参数,如果设置成功,返回true,本地时间将会变成lpSystemTime

ninedays的专栏 2567
上一篇: 经验总结:结构的数据对齐方式对于map.find的影响
下一篇: 知识点总结: c#,使用自定义类型来作为Dictionary的Key
strinkbug
博客等级 码龄24年 0粉丝 9原创
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

当前余额3.43元 前往充值 >
需支付:10.00元
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付元
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值