Index: libsn/sn-launcher.c
===================================================================
RCS file: /cvs/startup-notification/startup-notification/libsn/sn-launcher.c,v
retrieving revision 1.9
diff -u -r1.9 sn-launcher.c
--- libsn/sn-launcher.c	24 Mar 2004 16:21:40 -0000	1.9
+++ libsn/sn-launcher.c	13 Jun 2004 04:24:29 -0000
@@ -41,6 +41,7 @@
   char               *name;
   char               *description;
   int                 workspace;
+  Time                timestamp;
   char               *wmclass;
   char               *binary_name;
   char               *icon_name;
@@ -80,6 +81,7 @@
   sn_display_ref (context->display);
 
   context->workspace = -1;
+  context->timestamp = 0;
   
   sn_list_prepend (context_list, context);
 
@@ -177,6 +179,7 @@
   char *values[MAX_PROPS];  
   char *message;
   char workspacebuf[257];
+  char timestampbuf[257];
   char screenbuf[257];
   
   if (context->startup_id != NULL)
@@ -209,7 +212,8 @@
   
   sn_free (canonicalized_launcher);
   sn_free (canonicalized_launchee);
-  
+
+  context->timestamp = timestamp;  
   context->startup_id = s;
   
   i = 0;
@@ -223,6 +227,11 @@
   values[i] = screenbuf;
   ++i;
   
+  names[i] = "TIMESTAMP";
+  sprintf (timestampbuf, "%lu", context->timestamp);
+  values[i] = timestampbuf;
+  ++i;
+
   if (context->name != NULL)
     {
       names[i] = "NAME";
Index: libsn/sn-monitor.c
===================================================================
RCS file: /cvs/startup-notification/startup-notification/libsn/sn-monitor.c,v
retrieving revision 1.8
diff -u -r1.8 sn-monitor.c
--- libsn/sn-monitor.c	1 Dec 2002 02:49:20 -0000	1.8
+++ libsn/sn-monitor.c	13 Jun 2004 04:24:34 -0000
@@ -63,6 +63,7 @@
   char *wmclass;
 
   int workspace;
+  Time timestamp;
 
   char *binary_name;
   char *icon_name;  
@@ -303,6 +304,12 @@
   return sequence->workspace;
 }
 
+Time
+sn_startup_sequence_get_timestamp (SnStartupSequence *sequence)
+{
+  return sequence->timestamp;
+}
+
 const char*
 sn_startup_sequence_get_wmclass (SnStartupSequence *sequence)
 {
@@ -422,6 +429,7 @@
 
   sequence->screen = -1; /* not set */
   sequence->workspace = -1; /* not set */
+  sequence->timestamp = 0;
 
   sequence->initiation_time.tv_sec = 0;
   sequence->initiation_time.tv_usec = 0;
@@ -783,6 +791,15 @@
               sequence->workspace = workspace;
               changed = TRUE;
             }
+          else if (strcmp (names[i], "TIMESTAMP") == 0)
+            {
+              Time timestamp;
+              
+              timestamp = sn_internal_string_to_ulong (values[i]);
+
+              sequence->timestamp = timestamp;
+              changed = TRUE;
+            }
           else if (strcmp (names[i], "WMCLASS") == 0)
             {
               if (sequence->wmclass == NULL)
Index: libsn/sn-monitor.h
===================================================================
RCS file: /cvs/startup-notification/startup-notification/libsn/sn-monitor.h,v
retrieving revision 1.5
diff -u -r1.5 sn-monitor.h
--- libsn/sn-monitor.h	30 Nov 2002 05:05:22 -0000	1.5
+++ libsn/sn-monitor.h	13 Jun 2004 04:24:34 -0000
@@ -69,6 +69,7 @@
 const char* sn_startup_sequence_get_name                  (SnStartupSequence *sequence);
 const char* sn_startup_sequence_get_description           (SnStartupSequence *sequence);
 int         sn_startup_sequence_get_workspace             (SnStartupSequence *sequence);
+Time        sn_startup_sequence_get_timestamp             (SnStartupSequence *sequence);
 const char* sn_startup_sequence_get_wmclass               (SnStartupSequence *sequence);
 const char* sn_startup_sequence_get_binary_name           (SnStartupSequence *sequence);
 const char* sn_startup_sequence_get_icon_name             (SnStartupSequence *sequence);
Index: test/test-launcher.c
===================================================================
RCS file: /cvs/startup-notification/startup-notification/test/test-launcher.c,v
retrieving revision 1.3
diff -u -r1.3 test-launcher.c
--- test/test-launcher.c	21 Oct 2002 02:47:15 -0000	1.3
+++ test/test-launcher.c	13 Jun 2004 04:24:34 -0000
@@ -24,11 +24,66 @@
 
 #include <config.h>
 #include <libsn/sn.h>
+#include <assert.h>
 
 #include "test-boilerplate.h"
 
 static pid_t child_pid = 0;
 
+/* This is a poor way to obtain a timestamp normally (one should be available
+ * to the app from the user clicking on a button or something), but such a
+ * method is not available for this simple test application.
+ */
+Time
+slowly_obtain_timestamp(SnDisplay *display)
+{
+  Window xwindow;
+  Display *xdisplay;
+  XEvent event;
+
+  xdisplay = sn_display_get_x_display (display);
+
+  {
+    XSetWindowAttributes attrs;
+    Atom atom_name;
+    Atom atom_type;
+
+    attrs.override_redirect = True;
+    attrs.event_mask = PropertyChangeMask | StructureNotifyMask;
+
+    xwindow =
+      XCreateWindow (xdisplay,
+                     RootWindow (xdisplay, 0),
+                     -100, -100, 1, 1,
+                     0,
+                     CopyFromParent,
+                     CopyFromParent,
+                     CopyFromParent,
+                     CWOverrideRedirect | CWEventMask,
+                     &attrs);
+
+    atom_name = XInternAtom(xdisplay, "WM_NAME", TRUE);
+    assert(atom_name != None);
+    atom_type = XInternAtom(xdisplay, "STRING", TRUE);
+    assert(atom_type != None);
+
+    char *name = "Fake Window";
+    XChangeProperty (xdisplay, 
+                     xwindow, atom_name,
+                     atom_type,
+                     8, PropModeReplace, name, strlen (name));
+  }
+  
+  XWindowEvent (xdisplay,
+                xwindow,
+                PropertyChangeMask,
+                &event);
+
+  XDestroyWindow(xdisplay, xwindow);
+
+  return event.xproperty.time;
+}
+
 int
 main (int argc, char **argv)
 {
@@ -63,11 +118,12 @@
   sn_launcher_context_set_name (context, "Test Launch");
   sn_launcher_context_set_description (context, "Launching a test program for libsn");
   sn_launcher_context_set_binary_name (context, argv[1]);
-  
+
+  Time timestamp = slowly_obtain_timestamp (display);
   sn_launcher_context_initiate (context,
                                 "test-launcher",
                                 argv[1],
-                                CurrentTime); /* CurrentTime bad */
+                                timestamp);
 
   switch ((child_pid = fork ()))
     {
