Skip to content

Year 2038  #25

Description

@chironb

This app is great!

Had a bit of a problem using it. It appears that it suffers from the Year 2038 issues:

The Year 2038 problem (also called Y2038, Epochalypse, Y2k38, or Unix Y2K) relates to representing time in many digital systems as the number of seconds passed since 00:00:00 UTC on 1 January 1970 and storing it as a signed 32-bit integer. Such implementations cannot encode times after 03:14:07 UTC on 19 January 2038.

When you add a date that happens in the future and it's past the 2038 epoch, the program thinks you've entered a date in the past instead, and gives an error about the "...date is greater than or equal to the end date...".

Also, the text gets cut-off when trying to display this text. This may be a separate layout issue.

I believe the problem is in the file:
https://github.com/rickybassom/date-countdown/blob/master/src/MainWindow.vala

And might be some of this code:

private string? validate_input (string title, int end_date, int start_date) {
    if (title == "") return _("Enter title");
    if (start_date >= end_date) return _("Start date is greater than or equal to the end date");
    if (end_date < (int) get_time_now ().to_unix ()) return _("End date is smaller than or equal to the current date");
    if (start_date > (int) get_time_now ().to_unix ()) return _("Start date is greater than the current date");
    return null;
}   

And might also be some of this code:

private int unix_to_days (int unix_time) {
int days = (int) Math.ceil ((double) unix_time / (double) seconds_in_min);
return days;
}

I'm guess it's anywhere an "int" is used and probably needs whatever a 64-bit integer would be. I'm not a Vala programmer, I just play one on TV, :-)

Thanks!

  • Chiron

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions