Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

System.currentTimeMillis() returns a negative number #229

Closed
jtoledo1974 opened this issue Apr 26, 2014 · 3 comments
Closed

System.currentTimeMillis() returns a negative number #229

jtoledo1974 opened this issue Apr 26, 2014 · 3 comments

Comments

@jtoledo1974
Copy link
Contributor

jtoledo1974 commented Apr 26, 2014

From Kivy Remote Shell

from jnius import autoclass
System = autoclass('java.lang.System')
System.currentTimeMillis()
-1605849459

It is supposed to be a long integer

@jtoledo1974
Copy link
Contributor Author

I've verified the error using my own java method. The good news is that it seems to affect only long values returned from java, not the ones sent as a parameter.

public static long testlong(long param) {
    Log.d(TAG, "Parametro "+param);
    return param;
}

and calling from python

    import sys
    l = sys.maxint*2
    Logger.debug("testlong %s %s" % (l, str(ph.testlong(l))))

From which I get

D/PLANILLA(26699): Parametro 4294967294
I/python (24589): [DEBUG ] testlong 4294967294 -2

It's unfortunate because it's not possible to use the AlarmManager in android without working long integers. I've had a look at the code for pyjnius to try to provide a patch, but I'm afraid it's beyond my skills.

@inclement
Copy link
Member

Do you (or anyone else) know if this is still an issue? I guess it's a pyjnius problem anyway, not something to change in p4a.

@brentpicasso
Copy link
Contributor

I just noticed this fetching the time value from android.location.Location - getTime() returns a negative value when calling from python. Using latest pyjnius.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants