PracticeDev/study_cpp/test.cpp

21 lines
650 B
C++
Raw Permalink Normal View History

2022-12-20 17:31:11 +08:00
#include<stdio.h>
#include<string.h>
#include <iostream>
#include <sys/time.h>
int main()
{
// const char * str = "7c114eeb9859dfaf5391dc066e14bf47";
// //strcpy(str,"7c114eeb9859dfaf5391dc066e14bf47");
// std::string str2 = "7c114eeb9859dfaf5391dc066e14bf47";
// printf("str1: %s, str2: %s, strcmp: %d\n", str, str2.c_str(), strcmp(str, str2.c_str()));
struct timeval tv;
gettimeofday(&tv, NULL);
printf("struct len: %d, len 1/2: %d, len of tv_sec: %d, len of tv_usec: %d\n", sizeof(tv), sizeof(tv)/2, sizeof(tv.tv_sec), sizeof(tv.tv_usec));
printf("usec: %d\t sec: %d\n", tv.tv_usec, tv.tv_sec);
return 0;
}