易截截图软件、单文件、免安装、纯绿色、仅160KB

c 语言获取系统时间和世界各时区时间

The meaning of each is:
MemberMeaningRange
tm_sec
seconds after the minute
0-61*
tm_min
minutes after the hour
0-59
tm_hour
hours since midnight
0-23
tm_mday
day of the month
1-31
tm_mon
months since January
0-11
tm_year
years since 1900
tm_wday
days since Sunday
0-6
tm_yday
days since January 1
0-365
tm_isdst
Daylight Saving Time flag
下面程序计算美国凤凰城 (-7),中国北京(+8),和冰岛(0)时间:
#include <stdio.h>
#include <time.h> 
struct {
int tm_min;
int tm_hour;
int tm_mday;
int tm_mon;
int tm_year;
int tm_wday;
int tm_yday;
int tm_isdst;
}tm;
void show(struct tm * timeinfo,int j)
{
 int day,hour;
 if(j>0)
 {
if((j+timeinfo->tm_hour)/24==1)
 day=timeinfo->tm_mday+1;
else
 day=timeinfo->tm_mday;
 hour=(j+timeinfo->tm_hour)%24;
 }
 if(j==0)
 {
 day=timeinfo->tm_mday;
 hour=(j+timeinfo->tm_hour)%24;
 }
 if(j<0)
 {
if((j+timeinfo->tm_hour)/24<0)
 day=timeinfo->tm_mday-1;
else
 day=timeinfo->tm_mday;
 hour=(j+timeinfo->tm_hour)%24;
 }
 printf ( "%4d-%02d-%02d %02d:%02d:%02d\n",1900+timeinfo->tm_year, 1+timeinfo->tm_mon,
day,hour,timeinfo->tm_min,timeinfo->tm_sec);
}
void main ()
{
time_t timer;
struct tm * timeinfo,*ptm;
time ( &timer );//Pointer to an object of type time_t, where the time value is stored.
timeinfo = localtime ( &timer);//返回当地时区时间
ptm = gmtime ( &timer );//返回格林制时区时间
printf("按格式显示冰岛时间\n");
show(ptm,0);
printf("按格式显示美国凤凰城时间\n");
show(ptm,-7);
printf("按格式显示中国北京时间\n");
show(ptm,8);
}
按格式显示冰岛时间
2009-09-24 19:26:30
按格式显示美国凤凰城时间
2009-09-24 12:26:30
按格式显示中国北京时间
2009-09-25 03:26:30


相关文档:

c:\windows\temp目录权限设置

说明: 在编译向该请求提供服务所需资源的过程中出现错误。请检查下列特定错误详细信息并适当地修改源代码。
编译器错误信息: CS0016: 未能写入输出文件“c:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET Files\root\5bad199f\ab65559a\App_Web_index.aspx.cdcab7d2.anxmasko.dll”--“ ......

[摘自c#Bible]c#中namespace的使用(命名空间)

The C# classes that you design will be used by code that you write and possibly by code that
other people write. Your C# classes may be used by a VB.NET application or from within an
ASP.NET page. Moreover, your classes may very well be used alongside other classes
designed by other .NET develope ......

关于 s3c2416 hspi spi linux 驱动


        最近在做samsung
s3c2416
在linux下的spi驱动程序,测试了下samsung发布的spi的内核源代码,无论是采用dma或者非dma模式都无法工作。阅读该驱动代码,发现
这码应该是一个未完成的版本,存在很多的bug。于是在这个版本的基础上进行修改,重写一个可用的、支持全双工的通讯 ......

获取IP的C 代码

获取IP的C 代码 #include<stdio.h> #include<winsock2.h> #pragma comment(lib,"ws2_32.lib") void CheckIP(void) //定义CheckIP()函数,用于获取本机IP地址 { WSADATA wsaData; char name[255]; //定义用 ...
获取IP的C 代码
#include<stdio.h>
#include<winsock2.h>
#pragma comment(li ......

c陷阱与缺陷学习笔记

http://c.chinaitlab.com/c/basic/200907/789321.html
  词法陷阱:
    1        = 不同于==不要在程序中将两者写错,小心。将表达式与常量比较时,可将常量放在左边。
    2        &和| 不同于& ......
© 2009 ej38.com All Rights Reserved. 关于E健网联系我们 | 站点地图 | 赣ICP备09004571号