Write a C++ program called epoch.cpp that uses the system command date to displa
ID: 3919190 • Letter: W
Question
Write a
C++ program called epoch.cpp that uses the system command
date to display the time and date in a specic format. Your C++ program should first
request a Unix epoch (elapsed seconds since 1 Jan 1970) and then invoke the command
date two times. First, to display the time the specied epoch represents in the format
HH:MM:SS and then the date the specied epoch represents in the format Weekday Day
Month Year.
Example output:
user~$ make run
./epoch
Enter unix epoch: 1550000000
21:33:20
Tuesday 12 February 2019
important:
Your program should be using C++ functions like execve() and friends to execute
system commands.
Explanation / Answer
Use gmttime to convert from epoch to date time
Output:
Instead of nullptr in above code use user entered epoch
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.