Finding Kaaba (Qibla) Direction
It is not advisable to determine Qibla (Kaaba direction) using compass specially for Orienting Masajid. The following method which uses the sun is more reliable. It has been observed for centuries and reported in many books by Muslims around the world that two times a year the sun comes overhead above Kaaba. This is observational fact for centuries, and is used to set the correct Qibla (Kaaba) direction in places far from Makkah by Muslims for last so many centuries. Those two dates and times are:
May 28 at 9:18UT
July 16 at 9:27UT
When you observe the sun at these times (after converting it to your local time), you will be facing the Kaaba giving you Qibla (Kaaba) direction, because if there were a very high minaret over Kaaba reaching up to the sky, then you will see it just like you are seeing the sun. Now, let us take a few examples. If you are in Islamabad, Pakistan (+5 hours time difference from Greenwich), the local time to observe the sun would be 2:18pm on May 28, and 2:27pm on July 16. Similarly, if you are in Nova Scotia, Canada (-3 hours time difference from Greenwich), the local time to observe the sun would be 6:18am on May 28, and 6:27am on July 16.
If you are at a location that you cannot see the sun on the above mentioned two dates, then you can locate Qibla (Kaaba) from the sun when it comes overhead at a point diametrically opposite of Makkah on the globe and look for the following two dates and times:
November 28 at 21:09UT
January 16 at 21:29UT
Face toward the shadow from the sun at these times (after converting it to local time) and you will be facing Kaaba. If you can see the sun but cannot see the shadow, put your back towards the sun and your face will be towards Qibla (Kaaba).