summaryrefslogtreecommitdiff
path: root/vcl/generic/print/printerjob.cxx
diff options
context:
space:
mode:
authorMichael Meeks <michael.meeks@suse.com>2011-10-07 17:29:49 +0100
committerMichael Meeks <michael.meeks@suse.com>2011-10-25 13:41:54 +0100
commita53082c7c856eb5cf076ee8c14fd92939d6952b2 (patch)
tree6cf1548d54352b71e414386b77767788acebf505 /vcl/generic/print/printerjob.cxx
parent8d068d15b2dae039600aaa7bac7299055ce7aea8 (diff)
generic: more unix conditional compilation pieces and win32 porting
Diffstat (limited to 'vcl/generic/print/printerjob.cxx')
-rw-r--r--vcl/generic/print/printerjob.cxx42
1 files changed, 18 insertions, 24 deletions
diff --git a/vcl/generic/print/printerjob.cxx b/vcl/generic/print/printerjob.cxx
index d8a5d7196ecf..3c1280fc5076 100644
--- a/vcl/generic/print/printerjob.cxx
+++ b/vcl/generic/print/printerjob.cxx
@@ -297,20 +297,24 @@ PrinterJob::~PrinterJob ()
// osl::Directory::remove (maSpoolDirName);
}
-namespace psp
-{
-
-// get locale invariant, 7bit clean current local time string
-sal_Char*
-getLocalTime(sal_Char* pBuffer)
+static void WriteLocalTimePS( osl::File *rFile )
{
- time_t nTime = time (NULL);
- struct tm aTime;
- struct tm *pLocalTime = localtime_r (&nTime, &aTime);
-
- return asctime_r(pLocalTime, pBuffer);
-}
-
+ TimeValue m_start_time, tLocal;
+ oslDateTime date_time;
+ if (osl_getSystemTime( &m_start_time ) &&
+ osl_getLocalTimeFromSystemTime( &m_start_time, &tLocal ) &&
+ osl_getDateTimeFromTimeValue( &tLocal, &date_time ))
+ {
+ char ar[ 256 ];
+ snprintf(
+ ar, sizeof (ar),
+ "%04d-%02d-%02d %02d:%02d:%02d ",
+ date_time.Year, date_time.Month, date_time.Day,
+ date_time.Hours, date_time.Minutes, date_time.Seconds );
+ WritePS( rFile, ar );
+ }
+ else
+ WritePS( rFile, "Unknown-Time" );
}
static bool isAscii( const rtl::OUString& rStr )
@@ -375,18 +379,8 @@ PrinterJob::StartJob (
}
// Creation Date (locale independent local time)
- sal_Char pCreationDate [256];
WritePS (mpJobHeader, "%%CreationDate: (");
- getLocalTime(pCreationDate);
- for( unsigned int i = 0; i < SAL_N_ELEMENTS(pCreationDate); i++ )
- {
- if( pCreationDate[i] == '\n' )
- {
- pCreationDate[i] = 0;
- break;
- }
- }
- WritePS (mpJobHeader, pCreationDate );
+ WriteLocalTimePS (mpJobHeader);
WritePS (mpJobHeader, ")\n");
// Document Title