about:startup - Windows implementation of nsXULAppInfo::GetLaunchTimestamp
authorDaniel Brooks <db48x@db48x.net>
Fri, 03 Sep 2010 15:55:27 -0400
changeset 58823 b2943903899a5b817b6578bb03470e709f87e214
parent 58822 10c264df4a89afcbbd4d0a7618c42650c162e373
child 58824 09d8fea4df6b0caa88bf191333f707d5919d0c02
push id17440
push userdb48x@yahoo.com
push dateWed, 08 Dec 2010 04:15:54 +0000
treeherdermozilla-central@a89f24bf1798 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
milestone2.0b6pre
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
about:startup - Windows implementation of nsXULAppInfo::GetLaunchTimestamp
toolkit/xre/nsAppRunner.cpp
--- a/toolkit/xre/nsAppRunner.cpp
+++ b/toolkit/xre/nsAppRunner.cpp
@@ -864,16 +864,31 @@ NS_IMETHODIMP nsXULAppInfo::GetLaunchTim
   PRTime starttime = 0;
   sscanf(strrchr(stat, ')') + 2,
          "%*c %*d %*d %*d %*d %*d %*u %*u %*u %*u "
          "%*u %*u %*u %*u %*u %*d %*d %*d %*d %llu",
          &starttime);
 
   *aTimestamp = boottime + ((starttime / tickspersecond) * PR_USEC_PER_SEC);
   return NS_OK;
+#elif XP_WIN
+  FILETIME start, foo, bar, baz;
+  bool success = GetProcessTimes(GetCurrentProcess(), &start, &foo, &bar, &baz);
+  if (success)
+  {
+    // copied from NSPR _PR_FileTimeToPRTime
+    CopyMemory(aTimestamp, &start, sizeof(PRTime));
+#ifdef __GNUC__
+    *aTimestamp = (*aTimestamp - 116444736000000000LL) / 10LL;
+#else
+    *aTimestamp = (*aTimestamp - 116444736000000000i64) / 10i64;
+#endif    
+    return NS_OK;
+  }
+  return NS_ERROR_FAILURE;
 #else
   return NS_ERROR_NOT_IMPLEMENTED;
 #endif
 }
 
 /* readonly attribute unsigned long startupTimestamp; */
 NS_IMETHODIMP nsXULAppInfo::GetStartupTimestamp(PRUint64 *aTimestamp)
 {