Android Question "compiletime.jar" does not store the correct time.

vecino

Well-Known Member
Licensed User
Longtime User
Hello, there is a difference of several hours, why?
Thanks.

difer.png
 

vecino

Well-Known Member
Licensed User
Longtime User
Oh!!!, here it is:

compiletime.txt
#Fri Jul 09 08:07:54 GMT+01:00 2021
autoversion=93831.0
time=1625814474213

logs:
Log($"compilation time: $DateTime{mmCompileInfo.Get("time")}"$)
compilation time: 07/09/2021 03:07:54
 
Upvote 0

agraham

Expert
Licensed User
Longtime User
You are comparing the wrong things. The top line starting with a '#' is a comment, the actual compilation is saved as ticks in the line beginning 'time='.

I've looked inside the jar and if compiletime.txt exists it reads it and updates the autoversion and time fields and then resaves it - why I don't know, just overwriting it would seem better but I guess Erel had a reason us lesser mortals are unable to fathom.

I don't know where that comment line comes from, the jar doesn't seem to write it, but as it is there it persists over versions. Delete compiletime.txt and see if it reappears.
 
Upvote 0

vecino

Well-Known Member
Licensed User
Longtime User
In theory, when compiling, the compiletime.jar program increases the value of "autoversion" by 1 and saves in "time" the date at the time of compilation. And that is the problem, that in "time" there is 5 hours difference with the current time. That is precisely the one shown in the comment line starting with #.
 
Upvote 0

vecino

Well-Known Member
Licensed User
Longtime User
Hi, I know that the important data is "date", but that's the problem, it's 5 hours difference, and I'm not in New York but in Malaga (Spain).
 
Upvote 0

agraham

Expert
Licensed User
Longtime User
Hi, I know that the important data is "date",
I assume that you mean 'time'

I delved further. The content of compiletime.txt looks fine to me. The comment line is
# Thu Jul 08 15:30:41 GMT+1:00 2021
which agrees with the result of using the 'time' value
Log("Date = " & DateTime.Date(1625754641504) & " " & DateTime.Time(1625754641504))
which for me, in the UK and in British Summer Time is
Date = 07/08/2021 Time = 15:30:41
although the date is in US format as I haven't set DateFormat

The problem seems to be in your Log statement.
 
Upvote 0

vecino

Well-Known Member
Licensed User
Longtime User
Are you calling DateTime.SetTimezoneOffset somewhere? Don't.
Hi, I don't use that command anywhere, I have done a search (ctrl-f) all over the program and that doesn't show up.

I assume that you mean 'time'
Yes, "time", sorry.

Well, I don't understand it, I only have this in the Region Project Attributes:
#Region Project Attributes
#ApplicationLabel: preventa
#SupportedOrientations: portrait
#VersionCode: 20210606
#VersionName: 29 MultiEmp
#CustomBuildAction: 2, C:\java\jdk-11.0.1\bin\java.exe, -jar c:\Proyectos\compiletime.jar
#BridgeLogger: True
#End Region

And then I read the compiletime.txt file.
Nothing else, that's all.

I leave it as impossible :D
Thanks, friends.
 
Upvote 0

vecino

Well-Known Member
Licensed User
Longtime User
Hello, apparently it is not 5 hours less, but 6 hours more :D

To test, I created my own "compiletime.jar" and called it "mcopiletime.jar".
I have changed the name:
#CustomBuildAction: 2, C:\java\jdk-11.0.1\bin\java.exe, -jar c:\Proyectos\mcompiletime.jar
The result is the same, so I don't understand anything at all.
Now I really give it up as impossible.
Thanks, friends.

This is the code I used to create it:

B4X:
'Non-UI application (console / server application)
#Region Project Attributes
    #CommandLineArgs:
    #MergeLibraries: True
#End Region

Sub Process_Globals
    
End Sub

Sub AppStart (Args() As String)
    Dim cFile As String = "compiletime.txt"
    Dim cDirFiles As String = "..\Files\"
    Dim iComp As Int
    Dim mmap As Map
    '
    mmap.Initialize
    DateTime.DateFormat = "dd.MM.yyyy HH:mm:ss"
    '
    Try       
        mmap = File.ReadMap(cDirFiles,cFile)
        iComp = mmap.Get("autoversion")
    Catch
        iComp = 0
    End Try
    iComp = iComp +1
    '
    mmap.Put("autoversion",iComp)   
    mmap.Put("time",DateTime.Now)
    '
    File.WriteMap(File.DirApp,cFile,mmap)
    File.Copy(File.DirApp,cFile, "..\Files\",cFile)
End Sub
 
Upvote 0
Top