c language get local system absolute time

 c language  get local system absolute time

#include <stdio.h>
#include <sys/ioctl.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <time.h>

int main()
{
	char str[16] = {0};
	time_t now;
	struct tm *timenow = NULL;

	time(&now);
	timenow = localtime(&now);

	strftime(str, 64, "%Y%m%d%H%M%S", timenow);
	asctime(timenow);
	printf("current time is: %s \n", str);

	return 0;
}

Comments

Popular posts from this blog

Python Receiving and parse JSON Data via UDP protocol

ubus lua client method and event registration code demo/example