Objc constants source

Could you please point me where obj constants DISPATCH_TIME_NOW and NSEC_PER_SEC are from? Are there existing bindings or I could use some Java equivalent?

Thank you

If it is “final int” you can declare it yourself.

I would, if I knew what those constants are. If you Google them, they are used all over the place for delayed scheduling. For the time being I’ve used java.util.TimerTask, but wonder if iOS scheduler is a better option.

These constants are declared in dispatch/time.h as preprocessor macros. Natjgen currently does not create bindings for preprocessor macros automatically, because of the complexity involved. The bindings could be extended with these constants manually, contributions welcome (please discuss first before opening pull requests).

It could be investigated, how Swift is handling these (e.g. do they have a generic parser for them, or they just added them to the standard library by hand.

Note, that the real constants that are defined in the headers as extern variables are mapped by Natjgen to static methods e.g. in the Globals class with @CVariable annotation.

Thank you Gergely, I found it:

#define NSEC_PER_SEC 1000000000ull
#define DISPATCH_TIME_NOW (0ull)

I guess the first two are just straight Java long constants. Not sure what value (~0ull) would be in Java.

I think it would be really handy to have these constants in Globals, because they are used very often with methods that are already in Globals. Here is corresponding objc example:

    dispatch_time(DISPATCH_TIME_NOW, 10 * NSEC_PER_SEC),
       NSLog(@"parameter1: %d parameter2: %f", parameter1, parameter2);