diff --git a/nctime_money b/nctime_money new file mode 100755 index 0000000..cd60151 Binary files /dev/null and b/nctime_money differ diff --git a/nctime_money.c b/nctime_money.c index a1128f0..22f06ed 100644 --- a/nctime_money.c +++ b/nctime_money.c @@ -97,15 +97,20 @@ int main() { refresh(); break; // Exit the countdown loop } else { - // Calculate seconds, minutes, hours, days, months, and years - int seconds = timeDifference % 60; - int minutes = (timeDifference / 60) % 60; - int hours = (timeDifference / (60 * 60)) % 24; - int days = timeDifference / (24 * 60 * 60); - int months = (retireDate.tm_year - (currentTime / (365.25 * 24 * 60 * 60))) * 12 + retireDate.tm_mon - (currentTime / (30.44 * 24 * 60 * 60)); - int years = months / 12; - // Print the countdown + // Calculate seconds, minutes, hours, days, months, and years + int seconds = timeDifference % 60; + int minutes = (timeDifference / 60) % 60; + int hours = (timeDifference / (60 * 60)) % 24; + int days = timeDifference / (24 * 60 * 60); + + // Calculate the number of years, months, and days + int years = days / 365; + int remainingDays = days % 365; + int months = remainingDays / 30; // Approximate number of days in a month + remainingDays %= 30; // Remaining days after subtracting months + + // Print the countdown printw("Time remaining: %d years, %d months, %d days\n%d hours, %d minutes, %d seconds", years, months % 12, days % 7, hours, minutes, seconds); }