[openrtm-commit:01643] r744 - in branches/RELENG_1_1: . jp.go.aist.rtm.RTC jp.go.aist.rtm.RTC/Source/examples jp.go.aist.rtm.RTC/installer/resources/Source/examples jp.go.aist.rtm.RTC/installer/win32 jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/log jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/util/clock jp.go.aist.rtm.RTC/tests/src/jp/go/aist/rtm jp.go.aist.rtm.RTC/tests/src/jp/go/aist/rtm/RTC/log jp.go.aist.rtm.RTC/tests/src/jp/go/aist/rtm/RTC/util
openrtm @ openrtm.org
openrtm @ openrtm.org
2015年 10月 29日 (木) 16:09:00 JST
Author: kawauchi
Date: 2015-10-29 16:09:00 +0900 (Thu, 29 Oct 2015)
New Revision: 744
Added:
branches/RELENG_1_1/jp.go.aist.rtm.RTC/tests/src/jp/go/aist/rtm/AllTest110.java
branches/RELENG_1_1/jp.go.aist.rtm.RTC/tests/src/jp/go/aist/rtm/RTC/log/LogBufTimeTest.java
Modified:
branches/RELENG_1_1/
branches/RELENG_1_1/buildRTC.bat
branches/RELENG_1_1/jp.go.aist.rtm.RTC/
branches/RELENG_1_1/jp.go.aist.rtm.RTC/.project
branches/RELENG_1_1/jp.go.aist.rtm.RTC/Source/examples/start-orbd.vbs
branches/RELENG_1_1/jp.go.aist.rtm.RTC/build.xml
branches/RELENG_1_1/jp.go.aist.rtm.RTC/installer/resources/Source/examples/start-orbd.vbs
branches/RELENG_1_1/jp.go.aist.rtm.RTC/installer/win32/OpenRTM-aist-Java.wxs.in
branches/RELENG_1_1/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/log/Logbuf.java
branches/RELENG_1_1/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/util/clock/AdjustedClock.java
branches/RELENG_1_1/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/util/clock/SystemClock.java
branches/RELENG_1_1/jp.go.aist.rtm.RTC/tests/src/jp/go/aist/rtm/RTC/util/AdjustedClockTest.java
Log:
[compat,merge] r687-696 merged from trunk.
Property changes on: branches/RELENG_1_1
___________________________________________________________________
Modified: svn:mergeinfo
- /branches/RELENG_1_0_0:60-401
/branches/work/ConfigurationCallback:631-635
/branches/work/ForComponentActionListener:521-522
/branches/work/ForComponentObserverConsumer:534-543
/branches/work/ForConfigurationListener:524-526
/branches/work/ForFileNameservice:623-628
/branches/work/ForLogFormat:518-519
/branches/work/ForPortConnectListener:528-532
/branches/work/ForSDOServiceAdminClass:505-507
/branches/work/LoggerService:666-669
/branches/work/SourceSharing:591-603
/branches/work/ToGetProperties:545-548
/branches/work/ToIFR_ID:509-514
/trunk:621-622,629-658,662-663,670,672-673,678,680-685
+ /branches/RELENG_1_0_0:60-401
/branches/work/ConfigurationCallback:631-635
/branches/work/ForComponentActionListener:521-522
/branches/work/ForComponentObserverConsumer:534-543
/branches/work/ForConfigurationListener:524-526
/branches/work/ForFileNameservice:623-628
/branches/work/ForLogFormat:518-519
/branches/work/ForPortConnectListener:528-532
/branches/work/ForSDOServiceAdminClass:505-507
/branches/work/LoggerService:666-669
/branches/work/SourceSharing:591-603
/branches/work/ToGetProperties:545-548
/branches/work/ToIFR_ID:509-514
/trunk:621-622,629-658,662-663,670,672-673,678,680-685,687-696
Modified: branches/RELENG_1_1/buildRTC.bat
===================================================================
--- branches/RELENG_1_1/buildRTC.bat 2015-10-29 07:02:33 UTC (rev 743)
+++ branches/RELENG_1_1/buildRTC.bat 2015-10-29 07:09:00 UTC (rev 744)
@@ -1,7 +1,7 @@
set DUMMY=%ANT_HOME%
@rem set ANT_HOME=%ECLIPSE_HOME%\plugins\org.apache.ant_1.6.5\
@rem set ANT_HOME=%ECLIPSE_HOME%\plugins\org.apache.ant_1.7.0.v200706080842\
-set ANT_HOME=%ECLIPSE_HOME%\plugins\org.apache.ant_1.7.0.v200803061910\
+set ANT_HOME=%ECLIPSE_HOME%\plugins\org.apache.ant_1.8.3.v20120321-1730\
cd jp.go.aist.rtm.RTC
@@ -16,4 +16,3 @@
set ANT_HOME=%DUMMY%
exit /b 1
-
Property changes on: branches/RELENG_1_1/jp.go.aist.rtm.RTC
___________________________________________________________________
Modified: svn:mergeinfo
- /branches/RELENG_1_0/jp.go.aist.rtm.RTC:408-498
/branches/RELENG_1_0_0/jp.go.aist.rtm.RTC:60-401
/branches/work/ConfigurationCallback/jp.go.aist.rtm.RTC:631-635
/branches/work/ForComponentActionListener/jp.go.aist.rtm.RTC:521-522
/branches/work/ForComponentObserverConsumer/jp.go.aist.rtm.RTC:534-543
/branches/work/ForConfigurationListener/jp.go.aist.rtm.RTC:524-526
/branches/work/ForFileNameservice/jp.go.aist.rtm.RTC:623-628
/branches/work/ForLogFormat/jp.go.aist.rtm.RTC:518-519
/branches/work/ForPortConnectListener/jp.go.aist.rtm.RTC:528-532
/branches/work/ForSDOServiceAdminClass/jp.go.aist.rtm.RTC:505-507
/branches/work/LoggerService/jp.go.aist.rtm.RTC:666-669
/branches/work/SourceSharing/jp.go.aist.rtm.RTC:591-603
/branches/work/ToGetProperties/jp.go.aist.rtm.RTC:545-548
/branches/work/ToIFR_ID/jp.go.aist.rtm.RTC:509-514
/trunk/jp.go.aist.rtm.RTC:621-622,629-658,662-663,670,672-673,678,680-685
+ /branches/RELENG_1_0/jp.go.aist.rtm.RTC:408-498
/branches/RELENG_1_0_0/jp.go.aist.rtm.RTC:60-401
/branches/work/ConfigurationCallback/jp.go.aist.rtm.RTC:631-635
/branches/work/ForComponentActionListener/jp.go.aist.rtm.RTC:521-522
/branches/work/ForComponentObserverConsumer/jp.go.aist.rtm.RTC:534-543
/branches/work/ForConfigurationListener/jp.go.aist.rtm.RTC:524-526
/branches/work/ForFileNameservice/jp.go.aist.rtm.RTC:623-628
/branches/work/ForLogFormat/jp.go.aist.rtm.RTC:518-519
/branches/work/ForPortConnectListener/jp.go.aist.rtm.RTC:528-532
/branches/work/ForSDOServiceAdminClass/jp.go.aist.rtm.RTC:505-507
/branches/work/LoggerService/jp.go.aist.rtm.RTC:666-669
/branches/work/SourceSharing/jp.go.aist.rtm.RTC:591-603
/branches/work/ToGetProperties/jp.go.aist.rtm.RTC:545-548
/branches/work/ToIFR_ID/jp.go.aist.rtm.RTC:509-514
/trunk/jp.go.aist.rtm.RTC:621-622,629-658,662-663,670,672-673,678,680-685,687-696
Modified: branches/RELENG_1_1/jp.go.aist.rtm.RTC/.project
===================================================================
--- branches/RELENG_1_1/jp.go.aist.rtm.RTC/.project 2015-10-29 07:02:33 UTC (rev 743)
+++ branches/RELENG_1_1/jp.go.aist.rtm.RTC/.project 2015-10-29 07:09:00 UTC (rev 744)
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
- <name>OpenRTM-1.0.0-Java</name>
+ <name>OpenRTM-1.1.0-Java</name>
<comment></comment>
<projects>
</projects>
Modified: branches/RELENG_1_1/jp.go.aist.rtm.RTC/Source/examples/start-orbd.vbs
===================================================================
--- branches/RELENG_1_1/jp.go.aist.rtm.RTC/Source/examples/start-orbd.vbs 2015-10-29 07:02:33 UTC (rev 743)
+++ branches/RELENG_1_1/jp.go.aist.rtm.RTC/Source/examples/start-orbd.vbs 2015-10-29 07:09:00 UTC (rev 744)
@@ -1,20 +1,58 @@
+'orbdN®pXNvg
+'{XNvgÍ«ÏTEMPªÝè³êÄ¢é±ÆðOñƵܷ
+'ȨA«ÏTEMPÍÊáOSÉæèftHgÅÝè³êĢܷ
+
+
'N®pIuWFNgÌæ¾
Set objShell = WScript.CreateObject("WScript.Shell")
+
+strMode = objShell.Environment("Process").Item("PROCESSOR_ARCHITECTURE")
+
'JDKÌWXgL[ðZbg
-regJDKkey = "HKLM\SOFTWARE\JavaSoft\Java Development Kit"
+If UCase(strMode) = "X86" Then
+ regJDKkey = "HKLM\SOFTWARE\JavaSoft\Java Development Kit"
+Else
+ regJDKkey = "HKLM\SOFTWARE\Wow6432Node\JavaSoft\Java Development Kit"
+End If
+
'WXg©çJDKJgo[Wðæ¾
'objShell.RegRead("HKLM\SOFTWARE\JavaSoft\Java Development Kit\CurrentVersion")
+
'±êªAá¦Î"1.5"¾Æ·éÆA
'HKLM\SOFTWARE\JavaSoft\Java Development Kit\1.5\JavaHome
'ÉJDKJgo[WÌ[gtH_ªLÚ³êÄ¢é
Javahome = regJDKkey & "\" & objShell.RegRead(regJDKkey & "\CurrentVersion") & "\JavaHome"
+
'JDKJgo[WÌ[gtH_Javahome̺Ìbin\orbd.exeªÚIÌÀst@C
targetexe = """" & objShell.RegRead(Javahome) & "\bin\orbd.exe"""
+
'ÚIÌÀst@CtargetexeðKØÈIvVð¯ÄÀs³¹é
objShell.Run targetexe & " -ORBInitialPort 2809 -ORBInitialHost localhost -defaultdb ""%TEMP%""\orb.db"
-'±êÍá¦ÎAÌæ¤È±ÆðâÁÄéBìÆfBNgð[U[ÌtemptH_ÉwèB
+'±êÍá¦ÎAÌæ¤È±ÆðâÁÄéB½¾µAìÆfBNgð[U[ÌtemptH_ÉwèB
'cf:objShell.Run """C:\Program Files\Java\jdk1.5.0_14\bin\orbd.exe"" -ORBInitialPort 2809 -ORBInitialHost localhost"
'êIuWFNgðJú
Set objShell = Nothing
+
+' **********************************************************
+' OS o[WÌæ¾
+' **********************************************************
+Function GetOSVersion()
+
+ Dim strComputer, Wmi, colTarget, strWork, objRow, aData
+
+ strComputer = "."
+ Set Wmi = GetObject("winmgmts:{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")
+ Set colTarget = Wmi.ExecQuery( "select Version from Win32_OperatingSystem" )
+
+ For Each objRow in colTarget
+ strWork = objRow.Version
+ Next
+
+ aData = Split( strWork, "." )
+ strWork = aData(0) & "." & aData(1)
+
+ GetOSVersion = CDbl( strWork )
+
+End Function
\ No newline at end of file
Modified: branches/RELENG_1_1/jp.go.aist.rtm.RTC/build.xml
===================================================================
--- branches/RELENG_1_1/jp.go.aist.rtm.RTC/build.xml 2015-10-29 07:02:33 UTC (rev 743)
+++ branches/RELENG_1_1/jp.go.aist.rtm.RTC/build.xml 2015-10-29 07:09:00 UTC (rev 744)
@@ -626,10 +626,10 @@
<javac srcdir="${source.sdo}:${source.rtc}:${source.rtm}:${source.openrtm}" destdir="${build.dir}" classpath="lib/commons-cli-1.1.jar" encoding="UTF-8" />
+ <javac srcdir="${source.main}" destdir="${build.dir}" classpath="lib/commons-cli-1.1.jar" encoding="UTF-8" includes="go/aist/**" excludes="go/aist/ForSunOrb/**,go/aist/ForJacOrb/**"/>
- <javac srcdir="${source.main}:${source.rtcd}:${source.rtcprof}" destdir="${build.dir}" classpath="lib/commons-cli-1.1.jar" encoding="UTF-8" includes="go/aist/**" excludes="go/aist/ForSunOrb/**,go/aist/ForJacOrb/**" />
+ <javac srcdir="${source.rtcd}:${source.rtcprof}" destdir="${build.dir}" classpath="lib/commons-cli-1.1.jar" encoding="UTF-8"/>
-
<javac srcdir="${source.extension}:" destdir="${build.dir}" classpath="lib/commons-cli-1.1.jar" encoding="UTF-8" />
<delete dir="${source.examplestemp}" />
@@ -660,48 +660,6 @@
<javac srcdir="${source.examples}:" destdir="${build.dir}" classpath="lib/commons-cli-1.1.jar" encoding="UTF-8" />
- <copy todir="${source.common}" overwrite="true">
-
- <fileset dir="${source.sunorb}" >
-
- <include name="**/*.java" />
-
- </fileset>
-
- </copy>
-
- <javac srcdir="${source.main}:${source.rtcd}:${source.rtcprof}" destdir="${build.dir}" classpath="lib/commons-cli-1.1.jar" encoding="UTF-8" includes="go/aist/**" excludes="go/aist/ForSunOrb/**,go/aist/ForJacOrb/**" />
-
- <delete dir="${source.examplestemp}" />
-
- <native2ascii encoding="UTF-8" src="${source.examples}" dest="${source.examplestemp}" >
-
- <include name="**/*.java" />
-
- </native2ascii>
-
- <fixcrlf srcdir="${source.examplestemp}" eol="crlf" >
-
- <include name="**/*.java" />
-
- </fixcrlf>
-
- <copy todir="${source.examples}">
-
- <fileset dir="${source.examplestemp}" >
-
- <include name="**/*.java" />
-
- </fileset>
-
- </copy>
-
- <delete dir="${source.examplestemp}" />
-
- <javac srcdir="${source.examples}:" destdir="${build.dir}" classpath="lib/commons-cli-1.1.jar" encoding="UTF-8" />
-
-
-
</target>
@@ -791,7 +749,7 @@
</copy>
- <javac srcdir="${source.main}:${source.rtcd}:${source.rtcprof}" destdir="${build.dir}" classpath="lib/commons-cli-1.1.jar:/usr/local/JacORB/lib/jacorb.jar:" encoding="UTF-8" includes="go/aist/**" excludes="go/aist/ForSunOrb/**,go/aist/ForJacOrb/**" />
+ <javac srcdir="${source.main}:${source.rtcd}:${source.rtcprof}" destdir="${build.dir}" classpath="lib/commons-cli-1.1.jar:/usr/local/JacORB/lib/jacorb.jar:" encoding="UTF-8" includes="go/aist/**" />
<delete dir="${source.examplestemp}" />
@@ -829,7 +787,7 @@
</copy>
- <javac srcdir="${source.examples}:" destdir="${build.dir}" classpath="lib/commons-cli-1.1.jar:/usr/local/JacORB/lib/jacorb.jar:" encoding="UTF-8" includes="go/aist/**" excludes="go/aist/ForSunOrb/**,go/aist/ForJacOrb/**" />
+ <javac srcdir="${source.examples}:" destdir="${build.dir}" classpath="lib/commons-cli-1.1.jar:/usr/local/JacORB/lib/jacorb.jar:" encoding="UTF-8" includes="go/aist/**" />
</target>
@@ -870,7 +828,7 @@
</fileSet>
</batchtest>
</junit>
- <echo>All Test complete!</echo>
+ <echo>All Test complete!</echo>
</target>
<target name="dist" description="ã½ã¼ã¹ãã¨ã¯ã¹ãã¼ããã¾ã">
Modified: branches/RELENG_1_1/jp.go.aist.rtm.RTC/installer/resources/Source/examples/start-orbd.vbs
===================================================================
--- branches/RELENG_1_1/jp.go.aist.rtm.RTC/installer/resources/Source/examples/start-orbd.vbs 2015-10-29 07:02:33 UTC (rev 743)
+++ branches/RELENG_1_1/jp.go.aist.rtm.RTC/installer/resources/Source/examples/start-orbd.vbs 2015-10-29 07:09:00 UTC (rev 744)
@@ -6,8 +6,14 @@
'N®pIuWFNgÌæ¾
Set objShell = WScript.CreateObject("WScript.Shell")
+strMode = objShell.Environment("Process").Item("PROCESSOR_ARCHITECTURE")
+
'JDKÌWXgL[ðZbg
-regJDKkey = "HKLM\SOFTWARE\JavaSoft\Java Development Kit"
+If UCase(strMode) = "X86" Then
+ regJDKkey = "HKLM\SOFTWARE\JavaSoft\Java Development Kit"
+Else
+ regJDKkey = "HKLM\SOFTWARE\Wow6432Node\JavaSoft\Java Development Kit"
+End If
'WXg©çJDKJgo[Wðæ¾
'objShell.RegRead("HKLM\SOFTWARE\JavaSoft\Java Development Kit\CurrentVersion")
@@ -28,3 +34,25 @@
'êIuWFNgðJú
Set objShell = Nothing
+
+' **********************************************************
+' OS o[WÌæ¾
+' **********************************************************
+Function GetOSVersion()
+
+ Dim strComputer, Wmi, colTarget, strWork, objRow, aData
+
+ strComputer = "."
+ Set Wmi = GetObject("winmgmts:{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")
+ Set colTarget = Wmi.ExecQuery( "select Version from Win32_OperatingSystem" )
+
+ For Each objRow in colTarget
+ strWork = objRow.Version
+ Next
+
+ aData = Split( strWork, "." )
+ strWork = aData(0) & "." & aData(1)
+
+ GetOSVersion = CDbl( strWork )
+
+End Function
\ No newline at end of file
Modified: branches/RELENG_1_1/jp.go.aist.rtm.RTC/installer/win32/OpenRTM-aist-Java.wxs.in
===================================================================
--- branches/RELENG_1_1/jp.go.aist.rtm.RTC/installer/win32/OpenRTM-aist-Java.wxs.in 2015-10-29 07:02:33 UTC (rev 743)
+++ branches/RELENG_1_1/jp.go.aist.rtm.RTC/installer/win32/OpenRTM-aist-Java.wxs.in 2015-10-29 07:09:00 UTC (rev 744)
@@ -32,19 +32,25 @@
Name="JavaHome"
Type="raw" />
</Property>
-
+ <Property Id="JDK17">
+ <RegistrySearch Id="JDK17"
+ Root="HKLM"
+ Key="SOFTWARE\JavaSoft\Java Development Kit\1.7"
+ Name="JavaHome"
+ Type="raw" />
+ </Property>
<!-- RTSE Property-->
-<!--
- <Property Id="FILEEXISTS">
- <DirectorySearch Id="CheckFileDir" Path="C:\Program Files">
+
+ <Property Id="RTSE_FILEEXISTS">
+ <DirectorySearch Id="CheckFileDir" Path="C:\Program Files\OpenRTM-aist\{% Product.ShortVersion %}">
<DirectorySearch Id="CheckFileDir2" Path ="OpenRTP">
- <DirectorySearch Id="CheckFileDir3" Path ="RTSystemEditor">
+ <DirectorySearch Id="CheckFileDir3" Path ="{% Product.ShortVersion %}\RTSystemEditor">
<FileSearch Id="CheckFile" Name="RTSystemEditorRCP.exe" />
</DirectorySearch>
</DirectorySearch>
</DirectorySearch>
</Property>
--->
+
<!-- <SetProperty Id="FILEEXISTSDIR" After="AppSearch" Value="[FILEEXISTS]">
</SetProperty>-->
@@ -74,8 +80,8 @@
<!-- <Property Id="ALLUSERS" Value="1" /> -->
<!-- Check Conditions -->
- <Condition Message="[ProductName] requires JDK 1.5 or 1.6">
- <![CDATA[Installed OR (JDK15 <> "" OR JDK16 <> "")]]>
+ <Condition Message="[ProductName] requires JDK 1.5 or 1.6 or 1.7">
+ <![CDATA[Installed OR (JDK15 <> "" OR JDK16 <> "" OR JDK17 <> "")]]>
</Condition>
<Directory Id="TARGETDIR" Name="SourceDir">
@@ -1350,23 +1356,19 @@
<!-- OpenRTP tools -->
<?if $(env.INCLUDE_OPENRTP) = YES ?>
- <Feature Id="OpenRTP" Level="1" Title="OpenRT Platform Tool Chain">
- <!--
- <Condition Level ="1"><![CDATA[ (FILEEXISTS = "") ]]></Condition>
- <Condition Level ="0"><![CDATA[ (FILEEXISTS <> "") ]]></Condition>
- -->
+ <Feature Id="OpenRTP" Level="1" Title="OpenRT Platform Tool Chain"
+ ConfigurableDirectory="INSTALLLOCATION">
+ <Condition Level ="1"><![CDATA[ (RTSE_FILEEXISTS = "") ]]></Condition>
+ <Condition Level ="0"><![CDATA[ (RTSE_FILEEXISTS <> "") ]]></Condition>
+
<!-- rtse rcp -->
<Feature Id="RTSystemEditor" Level="1" Title="RTSystemEditor">
<ComponentRef Id="Openrtp" />
<ComponentRef Id="OpenrtpConfiguration" />
<ComponentRef Id="OpenrtpPlugins" />
- <!-- <ComponentRef Id="org.eclipse.core.runtime.compatibility.registry_3.2.200.v20080610" /> -->
<ComponentRef Id="OpenrtpPluginsOrg_eclipse_core_runtime_compatibility_registry_3_2_200_v20080610" />
- <!-- <ComponentRef Id="META_INF" /> -->
<ComponentRef Id="Meta_inf" />
- <!-- <ComponentRef Id="org.eclipse.equinox.launcher.win32.win32.x86_1.0.101.R34x_v20080731" /> -->
<ComponentRef Id="OpenrtpPluginsOrg_eclipse_equinox_launcher_win32_win32_x86_1_0_101_r34x_v20080731" />
- <!-- <ComponentRef Id="META_INF_2" /> -->
<ComponentRef Id="Meta_inf_2" />
</Feature>
</Feature>
Modified: branches/RELENG_1_1/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/log/Logbuf.java
===================================================================
--- branches/RELENG_1_1/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/log/Logbuf.java 2015-10-29 07:02:33 UTC (rev 743)
+++ branches/RELENG_1_1/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/log/Logbuf.java 2015-10-29 07:09:00 UTC (rev 744)
@@ -1,7 +1,9 @@
package jp.go.aist.rtm.RTC.log;
+import java.text.DecimalFormat;
import java.util.Date;
import java.util.IllegalFormatException;
+import java.util.Locale;
import java.util.Vector;
import java.util.logging.Formatter;
import java.util.logging.Handler;
@@ -43,6 +45,9 @@
public static final String VERBOSE_H = "VERBOSE :";
public static final String PARANOID_H = "PARANOID :";
+ private int TIME_CONV_UNIT = 1000;
+ private double DELTA_TIME = 0.000000000005;
+
/**
* <p>ããã©ã«ãã³ã³ã¹ãã©ã¯ã¿ã§ãã</p>
* Manager.* ã¨ãã¦ãã¬ã¼ãä½æããã
@@ -56,7 +61,7 @@
m_clock = ClockManager.getInstance().getClock("system");
if(Manager.isActive() ) {
if( Manager.instance().getConfig().getNode("logger.date_format")!=null ) {
- setDateFormat(Manager.instance().getConfig().getProperty("logger.date_format"));
+ setDateFormat(Manager.instance().getConfig().getProperty("logger.date_format"));
}
if( Manager.instance().getConfig().getNode("logger.clock_type")!=null ) {
setClockType(Manager.instance().getConfig().getProperty("logger.clock_type"));
@@ -165,11 +170,13 @@
protected String getDate() {
//æ¡è½ã¡ãé²ãããã«å¾®å°å¤ãå ç®
- long sec = (long)(m_clock.getTime().toDouble()*1000+0.0000005);
- Date date = new Date(sec);
+// long sec = (long)(m_clock.getTime().toDouble()*1000+0.000000000005);
+// Date date = new Date(sec);
StringBuilder sb = new StringBuilder();
- java.util.Formatter formatter = new java.util.Formatter(sb, java.util.Locale.US);
- return formatter.format(m_dateFormat,date,date,date,date,date,date,date,date,date,date).toString();
+// java.util.Formatter formatter = new java.util.Formatter(sb, java.util.Locale.US);
+// return formatter.format(m_dateFormat,date,date,date,date,date,date,date,date,date,date).toString();
+ TimeFormatter formatter = new TimeFormatter(sb, java.util.Locale.US);
+ return formatter.format(m_dateFormat, m_clock);
}
/**
@@ -477,11 +484,11 @@
* {@.en A clock type above mentioned.}
*/
public void setClockType(String clocktype) {
- m_clock = ClockManager.getInstance().getClock(clocktype);
- //è«çæéã®å ´åã¯åºåæ¸å¼ã®ããã©ã«ãè¨å®ãå¤æ´
- if(m_clock instanceof LogicalClock) {
- setDateFormat("%S %L");
- }
+ m_clock = ClockManager.getInstance().getClock(clocktype);
+ //è«çæéã®å ´åã¯åºåæ¸å¼ã®ããã©ã«ãè¨å®ãå¤æ´
+ if(m_clock instanceof LogicalClock) {
+ setDateFormat("%S %L");
+ }
}
/**
@@ -539,7 +546,7 @@
*/
private static boolean m_Enabled = false;
- class NullHandler extends Handler{
+ private class NullHandler extends Handler{
public void close() {
}
public void flush() {
@@ -547,5 +554,38 @@
public void publish(LogRecord record){
}
}
+
+ private class TimeFormatter {
+ private java.util.Formatter formatter;
+
+ public TimeFormatter(StringBuilder sb, Locale local ) {
+ formatter = new java.util.Formatter(sb, local);
+ }
+
+ public String format(String format, IClock clock) {
+ String result = "";
+ TimeValue time = clock.getTime();
+
+ if(format.contains("%tN")) {
+ long mc = time.getUsec()%TIME_CONV_UNIT;
+ String strmc = "";
+ try {
+ DecimalFormat df = new DecimalFormat();
+ df.applyPattern("0");
+ df.setMaximumIntegerDigits(3);
+ df.setMinimumIntegerDigits(3);
+ strmc = df.format(mc);
+ } catch(Exception e) {
+ strmc = Long.valueOf(mc).toString();
+ }
+ format = format.replace("%tN", strmc);
+ }
+ long sec = (long)(time.toDouble()*TIME_CONV_UNIT+DELTA_TIME);
+ Date date = new Date(sec);
+ result = formatter.format(format,date,date,date,date,date,date,date,date,date,date).toString();
+
+ return result;
+ }
+ }
}
Modified: branches/RELENG_1_1/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/util/clock/AdjustedClock.java
===================================================================
--- branches/RELENG_1_1/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/util/clock/AdjustedClock.java 2015-10-29 07:02:33 UTC (rev 743)
+++ branches/RELENG_1_1/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/util/clock/AdjustedClock.java 2015-10-29 07:09:00 UTC (rev 744)
@@ -12,19 +12,17 @@
* {@.en This class stores a offset time with current system clock when
* settime(), and gettime() returns adjusted clock by the offset.}
*/
-public class AdjustedClock implements IClock {
+public class AdjustedClock extends SystemClock {
private TimeValue m_offset;
public AdjustedClock() {
+ super();
m_offset = new TimeValue(0.0);
}
public TimeValue getTime() {
synchronized (m_offset) {
- long msec = System.currentTimeMillis();
- long sec = msec/1000;
- long usec = (msec - sec*1000)*1000;
- TimeValue base = new TimeValue(sec, usec);
+ TimeValue base = super.getTime();
return base.minus(m_offset);
}
}
@@ -32,10 +30,11 @@
public boolean setTime(TimeValue clocktime) {
synchronized (m_offset) {
long msec = System.currentTimeMillis();
- long sec = msec/1000;
- long usec = (msec - sec*1000)*1000;
+ long sec = msec/TIME_CONV_UNIT;
+ long usec = (msec - sec*TIME_CONV_UNIT)*TIME_CONV_UNIT;
TimeValue base = new TimeValue(sec, usec);
m_offset = base.minus(clocktime);
+ nanoBase = System.nanoTime();
}
return true;
}
Modified: branches/RELENG_1_1/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/util/clock/SystemClock.java
===================================================================
--- branches/RELENG_1_1/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/util/clock/SystemClock.java 2015-10-29 07:02:33 UTC (rev 743)
+++ branches/RELENG_1_1/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/util/clock/SystemClock.java 2015-10-29 07:09:00 UTC (rev 744)
@@ -11,11 +11,28 @@
* {@.en This class sets and gets system clock.}
*/
public class SystemClock implements IClock {
+ protected int TIME_CONV_UNIT = 1000;
+
+ protected long nanoBase;
+ private long prevmcSec;
+ private long nanoOffset;
+
+ public SystemClock() {
+ nanoBase = System.nanoTime();
+ nanoOffset = 0;
+ }
public TimeValue getTime() {
long msec = System.currentTimeMillis();
- long sec = msec/1000;
- long usec = (msec - sec*1000)*1000;
+ long diffNano = System.nanoTime() - nanoBase;
+ //
+ long sec = msec/TIME_CONV_UNIT;
+ if(prevmcSec!=msec) {
+ prevmcSec = msec;
+ nanoOffset = diffNano;
+ }
+ long modNano = ((diffNano-nanoOffset)%(TIME_CONV_UNIT*TIME_CONV_UNIT))/TIME_CONV_UNIT;
+ long usec = (msec - sec*TIME_CONV_UNIT)*TIME_CONV_UNIT + modNano;
TimeValue base = new TimeValue(sec, usec);
return base;
}
Copied: branches/RELENG_1_1/jp.go.aist.rtm.RTC/tests/src/jp/go/aist/rtm/AllTest110.java (from rev 696, trunk/jp.go.aist.rtm.RTC/tests/src/jp/go/aist/rtm/AllTest110.java)
===================================================================
--- branches/RELENG_1_1/jp.go.aist.rtm.RTC/tests/src/jp/go/aist/rtm/AllTest110.java (rev 0)
+++ branches/RELENG_1_1/jp.go.aist.rtm.RTC/tests/src/jp/go/aist/rtm/AllTest110.java 2015-10-29 07:09:00 UTC (rev 744)
@@ -0,0 +1,28 @@
+package jp.go.aist.rtm;
+
+import jp.go.aist.rtm.RTC.log.LogBufTimeTest;
+import jp.go.aist.rtm.RTC.log.LogbufTest;
+import jp.go.aist.rtm.RTC.util.AdjustedClockTest;
+import jp.go.aist.rtm.RTC.util.TimeValueTest;
+import jp.go.aist.rtm.RTC.buffer.RingBufferTest;
+import jp.go.aist.rtm.RTC.executionContext.*;
+import junit.framework.Test;
+import junit.framework.TestSuite;
+
+public class AllTest110 {
+
+ public static Test suite() {
+ TestSuite suite = new TestSuite("Test for 1.1.0");
+
+ suite.addTestSuite(TimeValueTest.class);
+ suite.addTestSuite(LogbufTest.class);
+ suite.addTestSuite(AdjustedClockTest.class);
+
+ suite.addTestSuite(LogBufTimeTest.class);
+ suite.addTestSuite(RingBufferTest.class);
+ suite.addTestSuite(ExtTrigExecutionContextTests.class);
+ suite.addTestSuite(PeriodicExecutionContextTests.class);
+
+ return suite;
+ }
+}
Copied: branches/RELENG_1_1/jp.go.aist.rtm.RTC/tests/src/jp/go/aist/rtm/RTC/log/LogBufTimeTest.java (from rev 696, trunk/jp.go.aist.rtm.RTC/tests/src/jp/go/aist/rtm/RTC/log/LogBufTimeTest.java)
===================================================================
--- branches/RELENG_1_1/jp.go.aist.rtm.RTC/tests/src/jp/go/aist/rtm/RTC/log/LogBufTimeTest.java (rev 0)
+++ branches/RELENG_1_1/jp.go.aist.rtm.RTC/tests/src/jp/go/aist/rtm/RTC/log/LogBufTimeTest.java 2015-10-29 07:09:00 UTC (rev 744)
@@ -0,0 +1,60 @@
+package jp.go.aist.rtm.RTC.log;
+
+import java.util.logging.ConsoleHandler;
+
+import junit.framework.TestCase;
+
+public class LogBufTimeTest extends TestCase {
+ protected void setUp() throws Exception {
+ super.setUp();
+ }
+
+ protected void tearDown() throws Exception {
+ super.tearDown();
+ }
+
+ /**
+ *
+ * ãã¤ã¯ãç§ã®åºåãã¹ã
+ * clock_time=adjustedã®å ´åï¼clock_time=systemã®å ´å
+ * ããããã§ãã¤ã¯ãç§ã®å¤ãæ£å¸¸ã«åºåããããã確èªãã
+ */
+ public void test_case0() {
+ Logbuf rtcout = new Logbuf("test0");
+
+ rtcout.setEnabled();
+ rtcout.setClockType("adjusted");
+ rtcout.addStream(new ConsoleHandler());
+ rtcout.setEnabled();
+ // Junitåºåãã¡ã¤ã«*.xmlã® <system-err>ã®æ¬ã«åºåããã
+ System.err.println("--- test_case0() adjusted ---");
+ rtcout.println(Logbuf.PARANOID, "PARANOID string to STDOUT 2");
+ rtcout.setDateFormat("%b %d %H:%M:%S.%Q %q");
+ rtcout.println(Logbuf.VERBOSE, "VERBOSE string to STDOUT 2");
+ rtcout.println(Logbuf.TRACE, "TRACE string to STDOUT 2");
+ rtcout.println(Logbuf.DEBUG, "DEBUG string to STDOUT 2");
+ rtcout.println(Logbuf.INFO, "INFO string to STDOUT 2");
+ rtcout.println(Logbuf.WARN, "WARN string to STDOUT 2");
+ rtcout.println(Logbuf.ERROR, "ERROR string to STDOUT 2");
+ rtcout.println(Logbuf.FATAL, "FATAL string to STDOUT 2");
+ rtcout.println(Logbuf.SILENT, "SILENT string to STDOUT 2");
+ // PARANOIDã¯ãã¤ã¯ãç§ã®åºåãªã
+ // VERBOSE以éã¯ãã¤ã¯ãç§ã®åºåãããã°OK
+
+ System.err.println("--- test_case0() system ---");
+ rtcout.setClockType("system");
+ rtcout.setDateFormat("%b %d %H:%M:%S.%Q");
+ rtcout.println(Logbuf.PARANOID, "PARANOID string to STDOUT 2");
+ rtcout.setDateFormat("%b %d %H:%M:%S.%Q %q");
+ rtcout.println(Logbuf.VERBOSE, "VERBOSE string to STDOUT 2");
+ rtcout.println(Logbuf.TRACE, "TRACE string to STDOUT 2");
+ rtcout.println(Logbuf.DEBUG, "DEBUG string to STDOUT 2");
+ rtcout.println(Logbuf.INFO, "INFO string to STDOUT 2");
+ rtcout.println(Logbuf.WARN, "WARN string to STDOUT 2");
+ rtcout.println(Logbuf.ERROR, "ERROR string to STDOUT 2");
+ rtcout.println(Logbuf.FATAL, "FATAL string to STDOUT 2");
+ rtcout.println(Logbuf.SILENT, "SILENT string to STDOUT 2");
+ // PARANOIDã¯ãã¤ã¯ãç§ã®åºåãªã
+ // VERBOSE以éã¯ãã¤ã¯ãç§ã®åºåãããã°OK
+ }
+}
Modified: branches/RELENG_1_1/jp.go.aist.rtm.RTC/tests/src/jp/go/aist/rtm/RTC/util/AdjustedClockTest.java
===================================================================
--- branches/RELENG_1_1/jp.go.aist.rtm.RTC/tests/src/jp/go/aist/rtm/RTC/util/AdjustedClockTest.java 2015-10-29 07:02:33 UTC (rev 743)
+++ branches/RELENG_1_1/jp.go.aist.rtm.RTC/tests/src/jp/go/aist/rtm/RTC/util/AdjustedClockTest.java 2015-10-29 07:09:00 UTC (rev 744)
@@ -38,7 +38,7 @@
long sec2 = msec2/1000;
long usec2 = (msec2 - sec2*1000)*1000;
assertEquals(sec2-30, clock.getTime().getSec());
- assertEquals(usec2, clock.getTime().getUsec());
+// assertEquals(usec2, clock.getTime().getUsec());
}
}
More information about the openrtm-commit
mailing list