Skip to content
Advertisement

Tag: datetime

Rounding of the millisecond part in Linux datetime

So I have the date format like this : 2019-10-19 23:55:42.797 and I want the millisecond part to be round of into the second so the output should look something like this: 2019-10-19 23:55:43 I have tried date -d “2019-10-19 23:55:42.797” “+%Y-%m-%d %H:%M:%S” but it’s giving me output like 2019-10-19 23:55:42 How should I do this in Linux bash shell?

Set System date and time using C++ in Linux

I am in the middle of developing a cross platform application that changes the system date and time to a specified value. I have completed the part for Windows. How can I set the system date and time from a C++ program in Linux? I am looking for a function similar to SetSystemTime(SYSTEMTIME &x). As far as I understood settimeofday()

Advertisement