need a little help with time calculation

Hello

I tried to implement oauth2 and youtube api. I can connect and can recover the access_token and other oauth required as expires_in json values.

What I'm trying to do is drive if my access token is valid or not before making another call to their api - youtube gives a value - expires_in that normally contains 3600, which I suppose is seconds. I'm trying to add this time now using clock_gettime(), but I don't get correct values for my calculation - nowTime + expiresInt.

Anyone can point out the problem with my code please? It could be a bad way to do it, but I thought that I spent a few hours on this subject before asking for help.

Thank you.

token = c.value("access_token").toString().toStdString();
    refreshtoken = c.value("refresh_token").toString().toStdString();
    saveValueFor("access_token", QString::fromStdString(token));
    string expires = c.value("expires_in").toString().toStdString();
    saveValueFor("refresh_token", QString::fromStdString(refreshtoken));
    struct timespec* start;
    clock_gettime(CLOCK_REALTIME, start);
    int nowTime = start->tv_sec;
    std::stringstream str(expires);
    int expiresInt;
    str >> expiresInt;
    nowTime += expiresInt;
    stringstream nowTimeString;//create a stringstream
    nowTimeString << nowTime;//add number to the stream

Now you install milliseconds and seconds.

Tags: BlackBerry Developers

Similar Questions

  • Need a little help with a code

    Hello adobe community!

    I've been fiddling around with FLASH MX and made a game VERY slowly.

    I picked up a lot since the beginning and you have restarted the game MUCH MUCH time = D...

    But I have now a copy which is neat and clean and works great BUT I came in a bit of a problem.

    I have _global.goldenticket = 0;   on my first image as well as other variables and I had one place where we can acquire a "goldenticket.

    now, things are starting to confuse me... ive added a button inside a clip which, if you click on 'must' check if I have a golden ticket and then let me go to the specified image...

    {We (Release)}

    {if(goldenticket=="1")}

    money-= 50;

    Energy-= 50;

    _root.gotoAndPlay ("enter");

    } else {}

    This.Enabled = False;

    }

    }

    However the button doesn't seem to see my ticket (even tho Ive added a dynamic text box to keep track of how I, 1)

    Ive tried different ways to get around this, but I can't make it work...

    Please someone help me... relatively simple answers please =------im only a few days of learning flash and codeing. but im enjoying what im doing so im learn quickly.

    will have my face on the screen waiting = D

    Thanks to everyone who took a glance at my son!

    If it's a variable _global then send it as a...

    {if(_Global.goldenticket=="1")}

    Also, if it is a number you should not use quotation marks around it.

  • Need a little help with AE

    Hi all, I'm having a small problem with After Effects. I'm a Design student computer games of second year and I'm trying to wrap my different modules for the year.

    One of my modules 3D and animation, I made my last animation output as PNG. There are tired of running at 24 frames per second depending on the 22 second audio clip. When I put the images in After Effects as a sequence PNG sequence is only 18 seconds long and makes out in 18 seconds.

    I put the composition 22 seconds long and do speed 24 seconds when I started the comp. I have a layer of PNG (images you will see) and a second layer of PNG (a rendered 3D Studio Max Zdepth) to create a depth of field effect.

    How can I get these PNG to make out at the speed I want? They always make out too fast.

    This will probably turn out to be something really simple, I apologize if this is! I tried to look online for other people asking, but I have too much time in the next week and can't afford to spend time looking around. I would be very happy if someone could give me a helping hand.

    Thank you.

    Make sure that you are interpreting the film sequence of still images at a good rate. Read this page.

  • So I need a little help with the Flash colors

    I always use the red, green and blue gradient colors Flash below for metal stuff, but how do I get the effect of this red color in different colors like yellow?color.png

    If you want to use predefined gradients, what you could do is the first color any field you want with one of them, and then select the fill and use the color Panel to replace the Red some other color you prefer.   If you have never worked with the degraded section of the color Panel, you will be probably it find a bettter tool to create and fine-tune transitions.

    You just doubleclick, this little red square in the lower left and it opens a color sample as you have demonstrated to select another color

  • need a little help with acs2

    Hi, I have box_mc and box2_mc, and I have an animation_mc (I've marked it Flash)

    I would if I drop box_mc box2_mc animation should play.

    My codes: to box1_mc

    onClipEvent (load) {}

    this.tabEnabled = false;

    This ._visible = false;

    orig_x = this ._x;

    orig_y = this ._y;

    }

    on {(press)

    this.startDrag ();

    }

    on (release) {}

    this.stopDrag ();

    This ._x = orig_x;

    This ._y = orig_y;

    If (eval (this._droptarget) == _level0.box2_mc) {}

    _level0.animation_mc. Play() //it does not work

    }

    }

    If you help me I will be happy (sorry for eng)

    There is nothing wrong with the code as show you if all three items are on the same main timeline.

    Use the function trace() to ensure that the conditional test is being satisfied and that the subject of animation_mc exist.

    on (release) {}

    this.stopDrag ();

    This ._x = orig_x;

    This ._y = orig_y;

    trace (Eval (this._droptarget));

    If (eval (this._droptarget) == _level0.box2_mc) {}

    trace (Eval (_level0.animation_mc));

    _level0.animation_mc. Play() //it does not work

    }

    }

  • Need a little help with a photo effect, examples on the inside.

    Hey everybody, I tried to reproduce this effect for some time without success.  I have attached a picture for example, if someone can help me I would really appreaciate, thanks a lot!

    http://S9.Photobucket.com/albums/A54/klubhead/?action=view & Current = l_3a18e6d1083b0f4ba7f01 58505d3aa4d.jpg

    If you have one of the newer versions of Photoshop, which includes the surface filter, there is a video tutorial to this call from the link "Dave Hill Photoshop effect tutorial" that shows how a similar effect using the native filters.

    http://www.graphictutorials.NET/Photoshop-tutorials/photo-effects/Dave-Hill-look-Photoshop - video tutorial.

    I also found a link to an article that uses the card Camera Raw to simulate the Lucis Art filter has a very heavy price. This article also includes parameters to simulate this effect if you use Lightroom.

    http://www.scottkelby.com/blog/2008/archives/1094

    A link to plug Lucis Art in the site:

    http://www.LucisArt.com/

  • I need a little help with the INSTR function

    Hello everyone,

    im still new to pl sql and experienced an issue with the INSTR function. I need to analyze some values of a CLOB containing the xml code and use INSTR to determine the beginning and end of the value, I would like to analyze.

    the data I need is in a <!-[CDATA [[Some Text]]]-> block. up to this point, I managed to take the start of the word, but I can't seem to capture the end of the CDATA block. I use this statement:

    POS: = INSTR (TO_CHAR (input_clob) [,'] ', pos2 + 6, 1);

    but it doesn't have the desired effect. [It seems to sort of go back to the length of the string, while the]-sign is actually in the xml file. my result would look to "Some Text]]--> < xmlxml >... < / xmlxml >...» ». [I tried to escape by writing ' \] "but if I do, the function returns zero and my parsed string is left blank.

    Unfortunately I can't use regular expressions, because I work with oracle 9.2i. Anyone know what I'm doing wrong?

    Thank you

    Edited by: user8719779 the 25.08.2009 02:23
    with my_tab as (select ''||chr(10)||
                           '  '||chr(10)||
                           '   '||chr(10)||
                           '  '||chr(10)||
                           '' col1 from dual)
    -- end of mimicking your data; USE SQL below:
    select substr(col1, instr(col1, '', 1, 1) - instr(col1, 'Hi members,

    Im trying to do some logical columns for calculations. It is a very simple calculation, but I can't seem to make it work in the repository.
    The data upon which I make eyes of calculation as follows.

    Issue Nr. | Question | Meet Nr. | Response | Answers (number of responses)
    1. | Job satisfaction | 1. | Very good | 8
    1. | Job satisfaction | 2 | Good | 2
    1. | Job satisfaction | 3 | Bad | 5
    1. | Job satisfaction | 4 | Very bad. 0

    It is an example of the data. Now, I want to make a logical column to calculate the 'happiness factor '. The formula looks like:

    (Very good + good) / (very good + good + good + bad) * 100 = happiness

    So it would be 10 / 15 * 100 = 66.66.

    Very simple, but I have no idea on how to accomplish this formula in the repository. What I was aiming for in my head, it was something like:

    Select the answers where [answer] Nr. (3,4) / select responses where [answer]. Nr in (1,2) * 100 = :)


    Does anyone know how to do this in the repositroy? It would be highly appreciated.

    Erik.

    Hello

    This happens when we don't know all the facts and we create our scenarios and responses only what we know...

    Now you can do if you do not use 'no opinion' or 'Empty response' in our 'answers' but again to tuition assistance box...

    'All answers worth calculation' =
    case when answer in ('list of what answers I want to aggregate', ((Very) Happy... (Very) Unhappy))
           then 'my new All answers'
           else 'answers I need to ignore'
    end
    

    and our dimmnesion should look like:

    'Type of survey' -> 'Question' -> 'All answers worth calculation' -> Happiness -> Answer
    

    in this case the levels should be no to the 'Question' but to our new "answers a calculation value..."

    So, for an issue with 21 responses it is only 6 entries ((very) happy, (very) unfortunate, Blank, do not know)
    A separate account solves your problem...

    In addition, in your last post I don't understand how you can sum UP non-numerical data (Happy/headaches)
    No aggregate data not digital (Happy/headaches)
    you aggregate your fact group by happiness(Happy/Upset)

    sum ('Table'.) ("' #Answers" by BOX WHEN in Answer (' very good ',' good ') THEN ELSE 'Evils' END 'Happy' *) *.

    I think you've got the ideea of how play with several groups on the same Assembly and how to manipulate BI...
    All you have to do is to play with your data to add or exclude what you need
    If the data is not there you want you allways can create a view in the database or in physical layer so it can help you more.
    On another thing... There is a way to filter data at the logical level at the source of the logical table, the content tab, where clause. Don't say you use here, just give it a shot

    Best regards and fun of it
    Nicolae

  • Hi all, I need a little help to try to solve a problem of updating Bios for a long time.

    I downloaded the new update of the Bios on the HP site. But when I try to install the update, the process goes up to only while it presents me with an error. Any help would be appreciated, I am trying to upgrade the Bios for the new firmware in order to perform a better processor. Thank you...

    Error code: 3033

    "GoTo" label not found

    on line 89 of w:\patches\i...ate\windows\installer.wbt

    My system is...

    Compaq Presario SR1339uk

    Serial number: CZB5050HBW

    System number: PS267AA

    Motherboard: Asus PTGD1 - LA

    BIOS version: 3.13 12/14/04

    Operating system: Windows XP Home Edition

    Not sure what's going on here, but here is a suggestion on how to properly install manually the update of the BIOS.

    Assume that you download SP26760.exe (BIOS 3.28)

    Start the update - go to the last message you get before it fails and stop. (must be where it prompts you to close the applications and will be saved).

    Open a DOS (command prompt).    You must be an administrator - so if you're running Vista or Win7 - make sure that 'run as administrator ' at the opening of the box.

    Once in the BACK, type:

    CD FOLDER

    go the the directory of temporary files.

    Then make a

    DIR /S 328.LE ROM

    to find the directory where the update files are located.    Type CD < directory name > to go in this directory (on my system, it was a folder called pft467D.tmp, but it might be different on your)

    CD pft467D.tmp

    Now manually invoke (the prompt back, no windows or the windows file manager) the update, with the appropriate switches.  By omitting the switches can cause other problems, as have reported activation of Windows problems.

    AFUWIN /i328. ROM /pbc

    For reference, on my system, here's what I saw in these folders:

    C:\Users\sumsolstice\AppData\Local\Temp\pft467D.tmp > dir

    Volume in drive C is DRIVE_C
    Volume serial number is FE8F-4AA6

    Directory of C:\Users\sumsolstice\AppData\Local\Temp\pft467D.tmp

    26/04/2011 11:11 < DIR >.
    26/04/2011 11:11 < DIR >...
    24/01/2006 15:31 524 288 328.le rom
    01/07/2004 10:54 53 248 AFUWIN.exe
    01/07/2004 10:54 amifldrv.sys 6 912
    21/02/2006 18:08 526 374 Installer.exe
    09/05/2006 17:10 sp26760.rtf 1 784
    11/04/2005 10:55 398 696 WBDEG44I. DLL
    6 file (s) on 1 511 302 bytes
    2 dir 110,361,944,064 bytes free

    C:\Users\sumsolstice\AppData\Local\Temp\pft467D.tmp > AFUWIN i328.rom /pbc

    It should work OK, however no guarantee if there's something else - but essentially - that's what the installer should do.   If this does not work for you - I wouldn't try to force things - you can make a good motherboard unusable quickly.

    For those who are looking to this announcement - the syntax is for this motherboard only - switches may be different for different motherboards.

    Good luck.!

    -DM (while I am an employee of HP for a long time, the comments/suggestions here are my own, not those of my employer).

  • Need help with custom calculation Script

    Hey everybody.  I'm using Acrobat X Pro and stumbling a bit on the syntax of the following equation.  I need to add the value of "Cell1" & "Cell2" then add the value of "Cell3.  However, the value of "Cell3" is entered by the user and specifies a percentage of the sum of "Cell1 &"Cell2".  For example: If the user enters "3" in "Cell3" I need the value returned at 3% of the sum of "Cell1" + "Cell2".  If the user enters "9" in "Cell3" I need the value returned for "Cell3" 9% of the sum of "Cell1 and Cell2" and the end result should be the sum of "Cell1 Cell2 + Cell3.  In more detail:

    If "Cell1" = "Cell2" $ 500 = $500 and "Cell3" = '3' then I need the returned value to be $1030,00.

    I hope this makes sense. Here's what I have so far, but alas, it does not work.  Any help would be GREATLY appreciated.

    Get the first value in the field, as a number

    var v1 = + getField("Cell1").value;

    Get the second field value, as a number

    var v2 = + getField("Cell2").value;

    Get the value of a field, a number transformation

    var v3 = + getField("Cell3"/100).value;

    Calculate and set the value of this field for the result

    Event.Value = v3 + (v1 + v2);

    Thank you

    Solan

    I have posted a reply, but realized that it wasn't what you wanted. There is some confusion about what you want for Cell3. A hand, you say that the user enter a vaule in the area, but them you say you want its calculated value based on what the user has entered and two other field values. It seems to me Cell3 should be the domain that the user enters the percentage, and the calculated field (Cell4) script could be:

    Get the first value in the field, as a number

    var v1 = + getField("Cell1").value;

    Get the second field value, as a number

    var v2 = + getField("Cell2").value;// get treatment field value, as a number

    Get the percentage

    var v3 = + getField("Cell3").value;

    Calculate and set the value of this field for the result

    Event.Value = (1 + v3 / 100) * (v1 + v2);

  • Need help with the calculation on the invoice form

    I've never used Adobe Acrobat and know nothing about JavaScript.  I am creating a form of invoice.  I have it almost complete but can't do 2 things resolved.

    1. If a line on the invoice is not used, I need the amount column empty, not 0.00.

    2. I need to add 2 totals (parts and labor) and calculate the sales tax on the total of these 2 items.

    Everything I read is way over my head. I'm an accountant, not a programmer!

    Thank you

    # 1, you can configure a custom JavaScript validate it is simply:

    // Custom Validate JavaScript
    if (+event.value === 0) event.value = "";
    

    # 2, use the simplified notation next to the calculation field:

    Parts * work * 0.085

    Replace 0.085 with tax rate that you use

  • New to Ae, need help with time remapping (tutorial anywhere?)

    I am very very big thing back to Ae (CS4) and I was with Premiere Pro CS4 to edit a video, but I need to speed up, but as many of you may know, when you use time remapping in Pr, the sound isn't sync.  However when you do it in Ae, it does.  Then...

    What I'm trying to do is to let the clip I am going for a bit of editing time, then gradually increase the speed to 250% of the original over six seconds, stay 250% for some time, and then gradually in the course of about six seconds to 100% of the original speed.

    I'm kind of having trouble finding how to use Ae well.  There are a lot of easy to understand tutorials out there for Pr, but I can't really find any good for Ae.

    You use the time remapping effect. In fact, when you enable TR, you will notice that the duration of the layer is not limited to the original boundaries more. You can extend beyond the layer's original point.

    So, what you want to do is to keep the TR keyframe at the point layer zero to a value of zero. Set a keyframe second point 06:00 of the layer, with a value of about 14:00 (if possible, because maybe the original clip has no more of any material). You did it like that because if you show 14 seconds of video in a six-second segment, the playback speed is about 250 percent speed. You can do better than 'roughly', but this would require using the speed graph...

    For the real variable speed to set the first keyframe (that at 0:00) to perform a "easy ease on", so the speed ramps up gradually (what means "mitigation" for any property). Setting speed to 100% can be reached at justwith degree sense, but to familiarize themselves with the speed graph will make much more accurate. I say common sense, because if you have a keyframe of a code value of time from 14:00 to 06:00, then a possible way to get back to 100% is to show four seconds of material in the four seconds left (in condition, once again, that your source material has something to 18:00). As you can see, TR needs abundant "handles" (IE, additional documents in the source layer) to work at its 'best.

Maybe you are looking for

  • Upgrade to Firefox 10.0.2 and lost all THE passwords DATA, bookmarks, settings ect...

    Yesterday, I've upgraded to Firefox 10.0.2 and worked fine... When I turned on my Mac Book Pro today he says I would like to import from Safari? Huh? No.... When it opened I had nothing! It's like a pure installation of firefox. I searched and everyt

  • Keithley GPIB USB HS-6487

    Dear all I want to us NI GPIB HS to control keithley 6487. Can I use the software provided by the manufacturer of Excelinx, which is in my opinion, written in C++. Is this possible or I need a player of LabView?

  • Spooky: Front lost control of the scheme code

    I have a LabVIEW (Win7-64B LabVIEW 14.0 32 bit) program that behaves a little bit scary. On some occasions, while the LabVIEW tandis que le LabVIEW programme program is running, suddenly the front panel controls are no longer read by the process of b

  • Updates Windows with dial-up

    I have dial up and to always, you need to download the update.  Can I disable these and download to a flash drive from another computer with fast internet and transfer to my computer

  • 0x0000007E during installation of Windows 7 Pro

    Hello. I just installed a new motherboard (ASUS M4A89GTD Pro/USB3) and I have some problems to install Windows 7 to start. I start from the CD and after that the files load the Windows 7 boot screen appears and then goes to the blue screen of death t