Broad Network


Geographical Time for C++

Date and Time in C++ Simplified - Part 1

Forward: In this part of the series we look at what is called Greenwich Mean Time (G.M.T), which is also known as Coordinated Universal Time (UTC); we also look at local time.

By: Chrysanthus Date Published: 25 Aug 2012

Introduction

This is part 1 of my series, Date and Time in C++, Simplified. In this part of the series we look at what is called Greenwich Mean Time (G.M.T), which is also known as Coordinated Universal Time (UTC); we also look at local time. This part of the series deals more with geography than programming.

Longitude
The world is round. It has a North Pole and South Pole. There are imaginary circles traced from the North Pole to the South Pole and back to the North Pole. Seen round the equator the distances between these circles are equally spaced. There are 360 of these circles. These circles are imaginary; they do not really exist. However they are useful in giving us the time. They are called longitudes.  

These longitudes are numbered and the numbers have the unit of degree. The longitude that passes through Britain in Europe and Ghana in Africa is longitude 0 degree. The next longitude to the east is longitude 1 degree.  The next one to the east is longitude 2 degrees.

These longitudes are grouped in equal groups of 15 longitudes per group. Each group can be called a Clock Zone. There are 24 of these clock zones (seen round the equator). Here 24 correspond to 24 hours a day. Longitude 0 degree is in the middle of its own clock zone.

Time
Consecutive clock zones have one-hour difference. Let us say it is 12 mid-night now in the clock zone of longitude 0 degree (Britain or Ghana). The time at the next clock zone east (Germany in Europe, Cameroon in Africa) is 1 O’clock in the morning; the time in the clock zone eastward (Finland in Europe, Zimbabwe in Africa) is 2 O’clock in the morning. You can trace round like this, through the equator, to be back at the stating point forming a 24-hour clock.

Local Time
When the sun is directly above your head, that is 12 noon in your country. That is your local time (it is not Greenwich Mean Time). Imagine that you are in Finland, which is 2 clock zones east of Britain. Britain has the reference clock zone. If the time in Finland is 2 O’clock, Finland’s local time, at that same time it would be 1 O’clock in Germany, German’s local time, and 0 O’clock in Britain, British local time.

Greenwich Mean Time
If you are in the clock zone of longitude 0 degree (Britain), the time you read from your watch is said to be Greenwich Mean Time. So, at the time 0 mid-night in Britain, we say the time is 0 O’clock Greenwich Mean Time. At that same time it is still 0 O’clock Greenwich Mean Time in Germany, and still 0 O’clock Greenwich Mean Time in Finland. The clock zone with longitude 0 degree passing through Britain is the reference clock zone for Greenwich Mean Time. Greenwich Mean time is the same in every country. For example, 1 O’clock Greenwich Mean Time is 1 O’clock Greenwich Mean Time in every country, which is 1 O’clock local time in Britain (since the British clock zone is a reference).

Note: 0’clock is also said to be 24 0’clock in the 24 hour-clock.

Relationship between Greenwich Mean Time and Local Time
To get the local time of a country in the east (of Britain) from the Greenwich Mean Time, add the number of corresponding clock zones on the east. To get the local time of a country in the west (of Britain) from the Greenwich Mean Time, subtract the number of corresponding clock zones on the west. For example, if the Greenwich Mean Time is 3 O’clock, Finland will have 3 + 2 = 5 O’clock, local time. Greenwich Mean Time is the local time of Britain and Ghana and any other country in the clock zone of longitude 0 degree.

The Hour
There are 24 hours in a day. The hour is divided into 60 minutes, which are each divided into 60 seconds.

Daylight Saving Time
In European countries the sun may not rise and set when you want in some seasons. So the country may change the expected time by one hour, for convenience. This is daylight saving, giving the phrase, “Daylight Saving Time”. When a country does this in a season, we say Daylight Saving Time is in effect.

Well, we have seen enough of geography. In the next part of the series we shall dive into the C++ programming features of Date and Time.

Chrys

Related Links

C++ Taking the Bull by the Horns
C++ Just After the Basics
Object Oriented Programming in C++
C++ Operators
C++ Templates
Exception Handling in C++
Container Library Sequences in C++ Simplified
Associative Container in C++ Simplified
String in C++ Standard Library Simplified
Date and Time in C++ Simplified
Advanced Course
Storage Duration in C++
Scopes in C++
Function and Operator Overloading in C++
Specifiers in C++
Some Features of C++ Entities
C++ Preprocessing Directives
Writing a C++ Container
C++ Namespace
Writing a C++ Application
More Related Links
Relational Database and Sybase
Windows User Interface
Computer Programmer – A Jack of all Trade – Poem
C++ Course
NEXT

Comments

Become the Writer's Fan
Send the Writer a Message