Question
Problem Statement: Write a program that accepts six input values: year, month, day, hours, minutes, and seconds and prints one value: the UNIX time number
Problem Statement:
Write a program that accepts six input values: year, month, day, hours, minutes, and seconds and prints one value: the UNIX time number ignoring time zones.
Constraints:
Write in the C programing language, do not use system calls, no variables(do not use an assignment statement inside a function, global variables are okay), Inputs are command line parameters.
Requirements:
If the year is less than 1970(prior to the UNIX Epoch), the output should be something like "invalid input, that is before the UNIX epoch", You are NOT required to validate day, month, hour, minute, or second values.
Hints:
Be careful of leap years(leap years are every 4 years, but not every 100 years, except when every 400), don't add a day for a leap year if the date is before March 1, use an array to pre-compute the number of days in a year before a month, don't use Int type for seconds, use functions.
Example:
01:46:40 UTC on Sunday, 9 September 2001 was the Unix billennium(Unix time number 1,000,000,000)
At 23:31:30 UTC on 13 February 2009 the decimal representation of Unix time reached 1,234,567,890 seconds(like the number row on a keyboard)
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started