我想将给定时间转换为纪元(time_t),反之亦然.任何人都可以告诉这个例程或算法是什么?
谢谢
更新
epoch_strt.tm_sec = 0;
epoch_strt.tm_min = 0;
epoch_strt.tm_hour = 0;
epoch_strt.tm_mday = 1;
epoch_strt.tm_mon = 1;
epoch_strt.tm_year = 70;
epoch_strt.tm_isdst = -1;
double nsecs = difftime(curtime, basetime);//current time from system, I converrting it to struct tm
Run Code Online (Sandbox Code Playgroud)
但由于某种原因,这总是返回32399.
我有一个像这样的json
{
"outer1": {
"outer2": {
"outer3": {
"key1": "value1",
"key2": "value2"
}
},
"outer4": {
"key1": "value1",
"key2": "value2"
}
}
}
Run Code Online (Sandbox Code Playgroud)
我希望输出是
[outer1.outer2.outer3]
key1 = value1
key2 = value2
[outer1.outer2.outer4]
key1 = value1
key2 = value2
Run Code Online (Sandbox Code Playgroud)
我尝试过jq -r 'to_entries|map("\(.key)=\(.value|tostring)")|.[]' test.json但这不是我想要的
这个问题可能很愚蠢,但我想知道,如果函数返回指向对象的指针时调用了复制构造函数?另外,请考虑以下事项
A* a1 = new A();
A* a = a1.GetPointer();
A* GetPoineter()
{
.....
return new A();
}
Run Code Online (Sandbox Code Playgroud)
那也是
A* a = a1.GetPointer();
Run Code Online (Sandbox Code Playgroud)
调用复制构造函数?
如果我删除a,它还会删除指向的地址a1吗?