how does the first one work?
It uses the Sun's altitude or azimuth (or both) to show the time.
Sundial
In a broader sense, a sundial is any device that uses the Sun's altitude or azimuth (or both) to show the time. 
who invented the first mechanical clock in 1300 Catholic monks which of the earliest civilizations used timekeeping devices? Hunter-gatherers, Prehistoric Europe, Mesoamericans, etc why did the monks invent the clock? To regulate daily prayer- and work-schedules strictly and to ensure accuracy can you give me examples of timekeeping devices? Astronomical bodies, sticks and bones to track the phases of the moon or the seasons, Stone circles, sexagesimal timekeeping, and vigesimal counting system name some of the innovations during the medieval period Clock, wristwatches, Clock of the Long Now, mechanical clock, and pendulum clock did ancient egypt use timekeeping devices? Yes, Shadow clocks and Sundials what about greece? They used water clocks, or clepsydrae, and water-based alarm clock name some of the innovations during the pre-modern period Mechanical clocks and pendulum clock is it possible to keep track of time underwater? Yes, by Marine chronometers how did the persians keep track of time? By using water clocks what device did the chinese invent to keep track of time? Outflow and inflow clepsydra is there an industry now that deals specifically with time keeping devices? Yes, clock and watch-making industry who invented the wristwatch? UNANSWERABLE what are the different types of clocks? Sundial, hourglass, water clocks, striking clock, watches, pendulum clock, and electric clock
wiki:13476052
Sundial [SEP] Introduction
The gnomon may be a rod, wire, or elaborately decorated metal casting. The style must be parallel to the axis of the Earth's rotation for the sundial to be accurate throughout the year. The style's angle from horizontal is equal to the sundial's geographical latitude. In a broader sense, a sundial is any device that uses the Sun's altitude or azimuth (or both) to show the time. In addition to their time-telling function, sundials are valued as decorative objects, literary metaphors, and objects of intrigue and mathematical study. A rudimentary sundial can be easily constructed to mark the passing of time by placing a stick in the sand or a nail in a board and placing markers at the edge of a shadow or outlining a shadow at intervals.