Question

Answer the following questions about time and timers.    In computing, time scales usually store the...


Answer the following questions about time and timers.

  
In computing, time scales usually store the current time as the number of seconds that have elapsed since the beginning of some “epoch”, which is an arbitrary date that determines the starting time.   For example, in the Network Time Protocol (NTP) this is defined as midnight January 1st (GMT) 1900. The elapsed seconds since the epoch are stored in a 32-bit unsigned integer.  

a. How many years can be represented in an NTP timestamp (ie, an unsigned 32 bit integer storing the number of seconds since 1 January 1900)?  


b. In many embedded systems, it is more practical to just consider the current year. In this case, the format is often modified such that 0 corresponds to midnight of January 1st of the current year. If a clock that was initialized to 0 at midnight of 1 Jan 2017 currently has a count of 5217504 seconds, what day and time does it represent?   (For example, your answer should be in the form: June 5, 4:59:12 am)

Homework Answers

Answer #1

(a)Total number of seconds that can be stored is

Number of seconds per day = 86400

Number of seconds per year = 365*86400

Number of years that can be stored = = 136.192

So the number of years that can be stored is 136 as the 137th year wont be stored completely

(b) Seconds passed = 5217504

Number of days passed = 5217504 / 86400 = 60

Since the year is 2017 (not a leap year), the date is Mar 2 (as 60 days have passed, current day is the 61st)

Number of seconds passed since midnight of mar 2 = 5217504 - 60 * 86400 = 33504

Number of hours passed since midnight mar 2 = 33504 / 3600(number of secs per hour) = 9

Therefore its mar 2, 9 am (+some minutes and seconds)

no. of seconds passed since mar 2, 9:00:00 am = 33504-9*3600=1104

Thus, no. of minutes = 1104/60 = 18

No of seconds = 1104%60 = 24

So, the time is March 2, 9:18:24 am (in the prescribed format)

Know the answer?
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for?
Ask your own homework help question
Similar Questions