How to resolve the algorithm Show the epoch step by step in the Icon and Unicon programming language
Published on 12 May 2024 09:40 PM
How to resolve the algorithm Show the epoch step by step in the Icon and Unicon programming language
Table of Contents
Problem Statement
Choose popular date libraries used by your language and show the epoch those libraries use. A demonstration is preferable (e.g. setting the internal representation of the date to 0 ms/ns/etc., or another way that will still show the epoch even if it is changed behind the scenes by the implementers), but text from (with links to) documentation is also acceptable where a demonstration is impossible/impractical. For consistency's sake, show the date in UTC time where possible.
Let's start with the solution:
Step by Step solution about How to resolve the algorithm Show the epoch step by step in the Icon and Unicon programming language
Source code in the icon programming language
link printf,datetime
procedure main()
# Unicon
now := gettimeofday().sec
if now = &now then printf("&now and gettimeofday().sec are equal\n")
printf("Now (UTC) %s, (local) %s\n",gtime(now),ctime(now))
printf("Epoch %s\n",gtime(0))
# Icon and Unicon
now := DateToSec(&date) + ClockToSec(&clock)
printf("Now is also %s and %s\n",SecToDate(now),SecToDateLine(now))
end
You may also check:How to resolve the algorithm Queue/Usage step by step in the Lambdatalk programming language
You may also check:How to resolve the algorithm Rock-paper-scissors step by step in the Prolog programming language
You may also check:How to resolve the algorithm Mind boggling card trick step by step in the Haskell programming language
You may also check:How to resolve the algorithm Honeycombs step by step in the C programming language
You may also check:How to resolve the algorithm Constrained random points on a circle step by step in the Frink programming language