AlkaffAhamed / Tahajjud-Calculator

A Command-Line Application in C++ to calculate Tahajjud Times

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Tahajjud Calculator

Tahajjud Calculator is a Command-Line Application written in C++ to calculate Tahajjud Times. User will input the Maghrib time and the next day's Fajr time and this application will calculate the time Tahajjud starts.

Tahajjud Definition

Muslims pray 5 times daily and in addition to that, some will pray Tahajjud time at night for extra benefits.

"The best time for Tahajjud is the last third portion of the night." (Abu Hurairah:Fiqh)

From the above definition, it is implied that the Tahajjud time starts at the ⅔ marker between Maghrib time and Fajr time. It ends about 10 to 15 minutes before Fajr time starts.

Worked Example

The following is a real life example for calculating Tahajjud starting time. This example is taken from Singapore for the date 13th November 2019.

Data

Parameters Values
Country Singapore (GMT +08:00)
Date 13th November 2019
Maghrib 6:51 pm
Isha 8:04 pm (for reference only, not required for calculation)
Next Day Fajr 5:27 am

Source: https://www.muis.gov.sg/-/media/Files/Corporate-Site/Prayer-Timetable-2019.pdf

Algorithm

The following steps are used to calculate the Tahajjud starting time:

Step 1

Calculate the exact time difference () between Maghrib () and next day Fajr ().

Step 2

Calculate the time interval () for one-third by dividing by 3.

Step 3

Either add twice the to or subtract from . This result will be the Tahajjud starting time ().

<or>

Calculation

We have

  1. Maghrib time: = 6:51 pm [18:51]
  2. Next day Fajr time: = 5:27 am [05:27]

Following the Algorithm:

Note: Actual time is in [square brackets] converted to 24-hour format and time interval is written normally

Step 1

= [05:27 + 1 day] - [18:51]

= 10:36 (10 hours and 36 minutes)

Step 2

= [10:36]

= 3:32 (3 hours and 32 minutes)

Step 3

= [18:51] + 2*(03:32)

= [18:51] + 7:04

= [25:55]

= [01:55 + 1 day] (next day 1:55 am)

<or>

= [05:27 + 1 day] - 03:32

= [01:55 + 1 day] (next day 1:55 am)

Timeline Plot

Here is a timeline showing the calculated values:

About

A Command-Line Application in C++ to calculate Tahajjud Times

License:MIT License


Languages

Language:C++ 100.0%