From: Ray Strode Date: Thu, 25 Sep 2008 15:29:39 +0000 (-0400) Subject: Clamp boot progress between 0.0 to 1.0 X-Git-Tag: 0.6.0~117 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=0d187adf78f3483bbf0d4daeec2e982d955688a9;p=thirdparty%2Fplymouth.git Clamp boot progress between 0.0 to 1.0 --- diff --git a/src/ply-boot-splash.c b/src/ply-boot-splash.c index 408e5c7d..fa5eee52 100644 --- a/src/ply-boot-splash.c +++ b/src/ply-boot-splash.c @@ -205,15 +205,19 @@ static void ply_boot_splash_update_progress (ply_boot_splash_t *splash) { double time_in_seconds; + double percentage; assert (splash != NULL); time_in_seconds = ply_get_timestamp () - splash->start_time; + percentage = CLAMP (time_in_seconds / splash->boot_duration, + 0.0, 1.0); + if (splash->plugin_interface->on_boot_progress != NULL) splash->plugin_interface->on_boot_progress (splash->plugin, time_in_seconds, - time_in_seconds / splash->boot_duration); + percentage); ply_event_loop_watch_for_timeout (splash->loop, 1.0 / UPDATES_PER_SECOND,