Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

Where's `CurrentTime` defined? How do I get it?

I’m trying to write a rudementary program to rotate the screen (using libXrandr). I couldn’t find a lot of info about libXrandr, outside of xrandr‘s source code and man pages. So, I decided to analyze xrandr‘s source code to learn about libXrandr.

Upon writing the initialization routines, I came across XRRSetScreenConfig, that calls for a Timestamp parameter:

Status XRRSetScreenConfig (Display *dpy,
            XRRScreenConfiguration *config,
            Drawable draw,
            int size_index,
            Rotation rotation,
            Time timestamp);

I’ve got all the parameters figured out, except for the last one, timestamp. I looked around xrandr.c for uses of the function to point me in the right direction to what’s supposed to be passed to it, and I found that a variable (?) named CurrentTime is passed in place of this parameter:

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

status = XRRSetScreenConfigAndRate (dpy, sc, root, (SizeID) size,
    (Rotation) (rotation | reflection),
    rate, CurrentTime);

(btw XRRSetScreenConfigAndRate has the same params as XRRSetScreenConfig, except with a couple extra parameters)

I looked around for where this variable is set, but I literally couldn’t find anywhere where it’s set, or even defined. Not even in Xrandr.h or its sub-includes.

So, I guess what my question is, what is CurrentTime? Is it literally just the current time in Unix time? Can I pass just a regular time_t timestamp to XRRSetScreenConfig? If not, how do I obtain a valid CurrentTime?

Any help would be greatly appreciated.

>Solution :

CurrentTime is a macro defined in the X11/X.h header, which is subsequently included by X11/Xlib.h. So you can just pass in that CurrentTime in your program without worrying about where and how it is defined.

Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading