Enlightenment CVS committal
Author : raster
Project : e17
Module : apps/e
Dir : e17/apps/e/src/bin
Modified Files:
e_widget_fsel.c
Log Message:
handle future modtime
===================================================================
RCS file: /cvs/e/e17/apps/e/src/bin/e_widget_fsel.c,v
retrieving revision 1.22
retrieving revision 1.23
diff -u -3 -r1.22 -r1.23
--- e_widget_fsel.c 26 Aug 2006 11:06:05 -0000 1.22
+++ e_widget_fsel.c 27 Aug 2006 04:05:18 -0000 1.23
@@ -628,27 +628,34 @@
static char *
_e_wid_file_time_get(time_t st_modtime)
{
- float diff;
+ time_t diff;
time_t ltime;
char modtime[256];
char *motime;
ltime = time(NULL);
- diff = difftime(ltime, st_modtime);
- if (diff <= 60)
- snprintf(modtime, sizeof(modtime), _("In the last minute"));
- if (diff > 60)
- snprintf(modtime, sizeof(modtime), _("%i minutes ago"), ((int)diff/60));
- if (diff >= 3600)
- snprintf(modtime, sizeof(modtime), _("%i hours ago"), ((int)diff/3600));
- if (diff >= 86400)
- snprintf(modtime, sizeof(modtime), _("%i days ago"), ((int)diff/86400));
- if (diff >= 604800)
- snprintf(modtime, sizeof(modtime), _("%i weeks ago"),
((int)diff/604800));
- if (diff >= 2592000)
- snprintf(modtime, sizeof(modtime), _("%i months ago"),
((int)diff/2592000));
- if (diff >= 31526000)
- snprintf(modtime, sizeof(modtime), _("%i years ago"),
((int)diff/31526000));
+ diff = ltime - st_modtime;
+ if (st_modtime > ltime)
+ {
+ snprintf(modtime, sizeof(modtime), _("In the future"));
+ }
+ else
+ {
+ if (diff <= 60)
+ snprintf(modtime, sizeof(modtime), _("In the last minute"));
+ else if (diff >= 31526000)
+ snprintf(modtime, sizeof(modtime), _("%i years ago"), (diff /
31526000));
+ else if (diff >= 2592000)
+ snprintf(modtime, sizeof(modtime), _("%i months ago"), (diff /
2592000));
+ else if (diff >= 604800)
+ snprintf(modtime, sizeof(modtime), _("%i weeks ago"), (diff /
604800));
+ else if (diff >= 86400)
+ snprintf(modtime, sizeof(modtime), _("%i days ago"), (diff / 86400));
+ else if (diff >= 3600)
+ snprintf(modtime, sizeof(modtime), _("%i hours ago"), (diff / 3600));
+ else if (diff > 60)
+ snprintf(modtime, sizeof(modtime), _("%i minutes ago"), (diff / 60));
+ }
if (modtime)
motime = strdup(modtime);
-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
enlightenment-cvs mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs