Index: doc/startup-notification.txt
===================================================================
RCS file: /cvs/startup-notification/startup-notification/doc/startup-notification.txt,v
retrieving revision 1.7
diff -p -u -r1.7 startup-notification.txt
--- doc/startup-notification.txt	16 Dec 2003 18:29:01 -0000	1.7
+++ doc/startup-notification.txt	27 Aug 2004 20:59:49 -0000
@@ -297,19 +297,22 @@ Communicating from a launcher process to
 ===
 
 To communicate the startup sequence information from a launcher
-process to a launchee process, when possible an environment variable
-should be used:
+process to a launchee process, when possible a pair of environment
+variables should be used:
 
  DESKTOP_STARTUP_ID
    value of the "ID" field in the "new" message
 
-It is suggested to unset this environment variable in the launchee
-as soon as it's read, to avoid possible reuse by some process started
-later by launchee.
-Mechanisms other than the environment variable may be used as well, as
-long as they are reliable. The environment variable is only used when
+ DESKTOP_STARTUP_TIMESTAMP
+   value of the "TIMESTAMP" field in a "new" or "changed" message
+
+It is suggested to unset these environment variables in the launchee
+as soon as they are read, to avoid possible reuse by some process
+started later by launchee.
+Mechanisms other than the environment variables may be used as well, as
+long as they are reliable. The environment variables are only used when
 the launchee code is in a process started by the launcher code; if
-they are in the same process the environment variable may not be
+they are in the same process the environment variables may not be
 relevant.
 
 Desktop entry spec extensions
Index: libsn/sn-launchee.c
===================================================================
RCS file: /cvs/startup-notification/startup-notification/libsn/sn-launchee.c,v
retrieving revision 1.6
diff -p -u -r1.6 sn-launchee.c
--- libsn/sn-launchee.c	15 Dec 2002 19:04:07 -0000	1.6
+++ libsn/sn-launchee.c	27 Aug 2004 20:59:49 -0000
@@ -32,6 +32,7 @@ struct SnLauncheeContext
   SnDisplay *display;
   int screen;
   char *startup_id;
+  Time *startup_timestamp;
 };
 
 /**
@@ -39,6 +40,7 @@ struct SnLauncheeContext
  * @display: an #SnDisplay
  * @screen: an X screen number
  * @startup_id: launch ID as in DESKTOP_STARTUP_ID env variable
+ * @startup_timestamp: launch time as in DESKTOP_STARTUP_TIMESTAMP env variable
  * 
  * Creates a new launchee-side context for the startup notification
  * protocol.
@@ -48,7 +50,8 @@ struct SnLauncheeContext
 SnLauncheeContext*
 sn_launchee_context_new (SnDisplay         *display,
                          int                screen,
-                         const char        *startup_id)
+                         const char        *startup_id,
+                         Time              *startup_timestamp)
 {
   SnLauncheeContext *context;
 
@@ -62,6 +65,14 @@ sn_launchee_context_new (SnDisplay      
   
   context->startup_id = sn_internal_strdup (startup_id);
 
+  if (startup_timestamp)
+    {
+      context->startup_timestamp = sn_new0 (Time, 1);
+      *context->startup_timestamp = *startup_timestamp;
+    }
+  else
+    context->startup_timestamp = NULL;
+
   return context;
 }
 
@@ -71,9 +82,9 @@ sn_launchee_context_new (SnDisplay      
  * @screen: an X screen number
  * 
  * Tries to create an #SnLauncheeContext given information in the
- * program's environment (DESKTOP_STARTUP_ID environment
- * variable). Returns %NULL if the env variables are not available or
- * can't be parsed.
+ * program's environment (DESKTOP_STARTUP_ID and
+ * DESKTOP_STARTUP_TIMESTAMP environment variables). Returns %NULL if
+ * the env variables are not available or can't be parsed.
  * 
  * Return value: a new #SnLauncheeContext or %NULL
  **/
@@ -82,13 +93,22 @@ sn_launchee_context_new_from_environment
                                           int        screen)
 {
   const char *id_str;
+  const char *timestamp_str;
+  Time timestamp;
   
   id_str = getenv ("DESKTOP_STARTUP_ID");
   
   if (id_str == NULL)
     return NULL;
+
+  timestamp_str = getenv ("DESKTOP_STARTUP_TIMESTAMP");
+
+  if (timestamp_str == NULL)
+    return NULL;
+
+  timestamp = strtoul (timestamp_str, NULL, 10);
   
-  return sn_launchee_context_new (display, screen, id_str);
+  return sn_launchee_context_new (display, screen, id_str, &timestamp);
 }
 
 void
@@ -105,6 +125,8 @@ sn_launchee_context_unref (SnLauncheeCon
     {
       sn_free (context->startup_id);
       
+      sn_free (context->startup_timestamp);
+
       sn_free (context);
     }
 }
@@ -123,6 +145,19 @@ sn_launchee_context_get_startup_id (SnLa
   return context->startup_id;
 }
 
+/**
+ * sn_launchee_context_get_startup_timestamp:
+ * @context: an #SnLauncheeContext
+ * 
+ * Get the startup timestamp for the context.
+ * 
+ * Return value: the startup timestamp for the context.
+ **/
+Time*
+sn_launchee_context_get_startup_timestamp (SnLauncheeContext *context)
+{
+  return context->startup_timestamp;
+}
 
 /**
  * sn_launchee_context_complete:
Index: libsn/sn-launchee.h
===================================================================
RCS file: /cvs/startup-notification/startup-notification/libsn/sn-launchee.h,v
retrieving revision 1.3
diff -p -u -r1.3 sn-launchee.h
--- libsn/sn-launchee.h	21 Oct 2002 02:47:15 -0000	1.3
+++ libsn/sn-launchee.h	27 Aug 2004 20:59:49 -0000
@@ -35,12 +35,15 @@ typedef struct SnLauncheeContext SnLaunc
 
 SnLauncheeContext* sn_launchee_context_new                  (SnDisplay         *display,
                                                              int                screen,
-                                                             const char        *startup_id);
+                                                             const char        *startup_id,
+                                                             Time              *startup_timestamp);
+
 SnLauncheeContext* sn_launchee_context_new_from_environment (SnDisplay         *display,
                                                              int                screen);
 void               sn_launchee_context_ref                  (SnLauncheeContext *context);
 void               sn_launchee_context_unref                (SnLauncheeContext *context);
 const char*        sn_launchee_context_get_startup_id       (SnLauncheeContext *context);
+Time*              sn_launchee_context_get_startup_timestamp(SnLauncheeContext *context);
 void               sn_launchee_context_complete             (SnLauncheeContext *context);
 void               sn_launchee_context_setup_window         (SnLauncheeContext *context,
                                                              Window             xwindow);
Index: libsn/sn-launcher.c
===================================================================
RCS file: /cvs/startup-notification/startup-notification/libsn/sn-launcher.c,v
retrieving revision 1.10
diff -p -u -r1.10 sn-launcher.c
--- libsn/sn-launcher.c	24 Jun 2004 08:32:38 -0000	1.10
+++ libsn/sn-launcher.c	27 Aug 2004 20:59:49 -0000
@@ -334,6 +334,13 @@ sn_launcher_context_get_startup_id (SnLa
   return context->startup_id;
 }
 
+Time
+sn_launcher_context_get_timestamp (SnLauncherContext *context)
+{
+
+  return context->timestamp;
+}
+
 sn_bool_t
 sn_launcher_context_get_initiated (SnLauncherContext *context)
 {
@@ -355,6 +362,8 @@ void
 sn_launcher_context_setup_child_process (SnLauncherContext *context)
 {
   char *startup_id;
+  char *startup_timestamp;
+  char timestampbuf[32];
 
   if (context->startup_id == NULL)
     {
@@ -365,12 +374,21 @@ sn_launcher_context_setup_child_process 
 
   /* Man we need glib here */
 
+  /* Add DESKTOP_STARTUP_ID to the environment */
   startup_id = sn_malloc (strlen (context->startup_id) + strlen ("DESKTOP_STARTUP_ID") + 3);
   strcpy (startup_id, "DESKTOP_STARTUP_ID=");
   strcat (startup_id, context->startup_id);
 
   putenv (startup_id);
 
+  /* Add DESKTOP_STARTUP_TIMESTAMP to the environment */
+  sprintf (timestampbuf, "%lu", context->timestamp);
+  startup_timestamp = sn_malloc (strlen (timestampbuf) + strlen ("DESKTOP_STARTUP_TIMESTAMP") + 3);
+  strcpy (startup_timestamp, "DESKTOP_STARTUP_TIMESTAMP=");
+  strcat (startup_timestamp, timestampbuf);
+
+  putenv (startup_timestamp);
+
   /* Can't free strings passed to putenv */
 }
 
Index: libsn/sn-launcher.h
===================================================================
RCS file: /cvs/startup-notification/startup-notification/libsn/sn-launcher.h,v
retrieving revision 1.6
diff -p -u -r1.6 sn-launcher.h
--- libsn/sn-launcher.h	1 Dec 2002 02:49:20 -0000	1.6
+++ libsn/sn-launcher.h	27 Aug 2004 20:59:49 -0000
@@ -45,6 +45,7 @@ void        sn_launcher_context_initiate
                                                    Time               timestamp);
 void        sn_launcher_context_complete          (SnLauncherContext *context);
 const char* sn_launcher_context_get_startup_id    (SnLauncherContext *context);
+Time        sn_launcher_context_get_timestamp     (SnLauncherContext *context);
 sn_bool_t   sn_launcher_context_get_initiated     (SnLauncherContext *context);
 
 void        sn_launcher_context_setup_child_process (SnLauncherContext *context);
