--- plugins/g15_plugin_clock.c.old	2008-03-21 20:06:11.000000000 +0100
+++ plugins/g15_plugin_clock.c	2008-03-22 00:06:17.000000000 +0100
@@ -56,6 +56,7 @@
 static int mode=1;
 static int showdate=0;
 static int digital=1;
+static int seconds=1;
 g15canvas *static_canvas = NULL;
 
 //----------------------------------------------------------------------------
@@ -140,12 +141,14 @@
     int narrows=0;
     int totalwidth=0;
     char buf[10];
+    char sec[4];
     char ampm[3];
     int height = G15_LCD_HEIGHT - 1;
  
     time_t currtime = time(NULL);
     
     memset(buf,0,10);
+    memset(sec,0,4);
     memset(ampm,0,3);
     if(showdate) {
         char buf2[40];
@@ -155,22 +158,26 @@
       }
 
     if(mode) {
-   	strftime(buf,6,"%H:%M",localtime(&currtime));
+   	strftime(buf,6,"%k:%M",localtime(&currtime));
     } else { 
         strftime(buf,6,"%l:%M",localtime(&currtime));
 	strftime(ampm,3,"%p",localtime(&currtime));
     }
-    if(buf[0]==49) 
+    if(seconds)
+	    strftime(sec,4,":%S",localtime(&currtime));
+      
+    if(buf[0]==49 || (buf[0]==' ' && buf[1]==49)) 
     	narrows=1;
     
     len = strlen(buf); 
     if(buf[0]==' ')
-     len++;
+      len++;
+    if(seconds)
+      len++;
     
+    totalwidth=len*20;
     if(narrows)
-        totalwidth=(len*20)+(15);
-    else
-        totalwidth=len*20;
+        totalwidth+=15;
 
     for (col=0;col<len;col++) 
       {
@@ -185,9 +192,18 @@
 	if (num >= 0)
 	  g15r_drawBigNum (canvas, (80-(totalwidth)/2)+col*20, 1,(80-(totalwidth)/2)+(col+1)*20, height, G15_COLOR_BLACK, num);
       }
+
+    if(buf[0]==' ')
+      len--;
+    if(sec[0]==0)
+      len++;
+    int xpos = (80-(totalwidth)/2)+(len-1)*20;
+
+    if(sec[0]!=0)
+      g15r_renderString (canvas,(unsigned char *)sec,0,G15_TEXT_LARGE,xpos,height-6);
     
     if(ampm[0]!=0)
-      g15r_renderString (canvas,(unsigned char *)ampm,0,G15_TEXT_LARGE,totalwidth+15,height-6);
+      g15r_renderString (canvas,(unsigned char *)ampm,0,G15_TEXT_LARGE,xpos+2,1);
 
     return G15_PLUGIN_OK;
 }
@@ -227,7 +243,8 @@
   g15r_drawLine(c, CLOCK_CENTERX+1,  CLOCK_CENTERY, xm,  ym,   G15_COLOR_BLACK);
 
   // second:
-  g15r_drawLine(c, CLOCK_CENTERX,    CLOCK_CENTERY,   xs,  ys,   G15_COLOR_BLACK);
+  if(seconds)
+    g15r_drawLine(c, CLOCK_CENTERX,    CLOCK_CENTERY,   xs,  ys,   G15_COLOR_BLACK);
   
   //
   // draw texts:
@@ -243,9 +260,9 @@
   sprintf(date, "%d.%s", t->tm_mday, mon);
   sprintf(year, "%4d AD", t->tm_year+1900);
   if(mode)
-    strftime(time,sizeof(time),"%H:%M:%S",t);
+    strftime(time,sizeof(time),(seconds ? "%H:%M:%S" : "%H:%M"),t);
   else 
-    strftime(time,sizeof(time),"%r",t);
+    strftime(time,sizeof(time),(seconds ? "%r" : "%I:%M %p"),t);
   
   if(showdate) {
   	g15r_renderString(c, (unsigned char*)time,  0, G15_TEXT_LARGE, 60, 4);
@@ -303,10 +320,14 @@
                 showdate = 1^showdate;
                 g15daemon_cfg_write_bool(clockcfg, "ShowDate", showdate);   
             }
-	    if(myevent->value & G15_KEY_L4) {
-	    	digital = 1^digital;
-		g15daemon_cfg_write_bool(clockcfg, "Digital", digital);
-	    }
+            if(myevent->value & G15_KEY_L4) {
+                digital = 1^digital;
+                g15daemon_cfg_write_bool(clockcfg, "Digital", digital);
+            }
+            if(myevent->value & G15_KEY_L5) {
+                seconds = 1^seconds;
+                g15daemon_cfg_write_bool(clockcfg, "Seconds", seconds);
+            }
 //        printf("Clock plugin received keypress event : %i\n",myevent->value);
           break;
         case G15_EVENT_VISIBILITY_CHANGED:
@@ -330,6 +351,7 @@
     mode=g15daemon_cfg_read_bool(clockcfg, "24hrFormat",1);
     showdate=g15daemon_cfg_read_bool(clockcfg, "ShowDate",0);
     digital=g15daemon_cfg_read_bool(clockcfg, "Digital",1);
+    seconds=g15daemon_cfg_read_bool(clockcfg, "Seconds",1);
 
     static_canvas = (g15canvas*)malloc(sizeof(g15canvas));
     if (static_canvas != NULL)
