3DS developement - delay command in c for 3ds

Discussion in '3DS - Homebrew Development and Emulators' started by julian20, Apr 27, 2015.

  1. julian20
    OP

    julian20 GBAtemp Fan

    Member
    336
    265
    Jan 10, 2015
    Gambia, The
    Is there a delay command in C for 3ds developement
     
  2. elhobbs

    elhobbs GBAtemp Advanced Fan

    Member
    762
    284
    Jul 28, 2008
    United States
    A sleep function? svcSleepThread(s64 ns); Where ns is in nanoseconds. You can also create events and mutexes which you can wait on with svcWaitSynchronization or svcWaitSynchronizationN. If that does not answer your question then try to be a little more specific.
     
    Margen67 likes this.
  3. julian20
    OP

    julian20 GBAtemp Fan

    Member
    336
    265
    Jan 10, 2015
    Gambia, The
    TX!!!
     
    Margen67 likes this.
  4. julian20
    OP

    julian20 GBAtemp Fan

    Member
    336
    265
    Jan 10, 2015
    Gambia, The
    sry pls ignore this
     
  5. daxtsu

    daxtsu GBAtemp Guru

    Member
    5,490
    3,877
    Jun 9, 2007
    It's in nanoseconds. If you need a delay which are actual seconds, multiply it by 1.000.000.000 (1000 * 1000 * 1000, because multiplying by 1000 will give you microseconds, and then another 1000 will give you milliseconds, then finally, the last 1000 gives seconds). So if you're trying to wait 5 seconds, 5 * 1.000.000.000 should do it.
     
  6. Aurelio

    Aurelio Member

    Newcomer
    29
    33
    Jun 25, 2008
    Italy
    1 second is 1.000.000.000 nanoseconds, not 1.000.000 :)
     
  7. daxtsu

    daxtsu GBAtemp Guru

    Member
    5,490
    3,877
    Jun 9, 2007
    Whoops, corrected. Forgot about microseconds.
     
  8. julian20
    OP

    julian20 GBAtemp Fan

    Member
    336
    265
    Jan 10, 2015
    Gambia, The
    Yeah sry i already know, i thuoght ns are ms.......
    But again tx
     
  9. gudenau

    gudenau Never a unique idea

    Member
    3,236
    1,216
    Jul 7, 2010
    United States
    /dev/random
    The only other way to do that is a loop, but that will be much more inaccurate than svcSleepThread.
     
  10. Technicmaster0

    Technicmaster0 GBAtemp Addict

    Member
    2,997
    598
    Oct 22, 2011
    Gambia, The
    You can use the following code as well:
    Code:
    		int i;
    		for (i=0; i<= 60; i++)
    			gspWaitForVBlank();
    It will wait one minute/ 60 frames.
     
  11. elhobbs

    elhobbs GBAtemp Advanced Fan

    Member
    762
    284
    Jul 28, 2008
    United States
    And to pile on one more - hidWaitForEvent looks useful too