Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8110933
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T01:56:04+00:00 2026-06-06T01:56:04+00:00

Xcode’s dispatch_after template double delayInSeconds = 2.0; double delayInNanoSeconds = delayInSeconds * NSEC_PER_SEC; dispatch_time_t

  • 0

Xcode’s dispatch_after template

double delayInSeconds = 2.0;
double delayInNanoSeconds = delayInSeconds * NSEC_PER_SEC;
dispatch_time_t popTime = dispatch_time(DISPATCH_TIME_NOW, delayInNanoSeconds);
dispatch_after(popTime, dispatch_get_main_queue(), ^(void){
});

causes the following warning

Implicit conversion turns floating-point number into integer: ‘double’ to ‘int64_t’ (aka ‘long long’)

because

delayInNanoSeconds is converted from a double to an int64_t implicitly

How bad is this?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-06T01:56:05+00:00Added an answer on June 6, 2026 at 1:56 am

    Once you’ve converted the time from seconds (expressed in delayInSeconds) to nanoseconds (expressed in delayInNanoSeconds), you don’t need the extra precision of a double and it’s safe to convert to a long long. You can cast it in the call to dispatch_time():

    double delayInSeconds = 2.0;
    double delayInNanoSeconds = delayInSeconds * NSEC_PER_SEC;
    
    dispatch_time_t popTime = dispatch_time(DISPATCH_TIME_NOW,
                                            (int64_t)delayInNanoSeconds);
    
    dispatch_after(popTime, dispatch_get_main_queue(), ^(void){});
    

    This should cause the warning to go away. Alternatively you could change the type of delayInNanoSeconds.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

XCode's OpenGL template seems to be cheating to solve this stretched viewport problem I've
Xcode 4 completely changed the (project) template system. There's a lot more you can
XCode issues warning for my implementation of global operator new: void *operator new(size_t blocksize);
XCode: This template provides a starting point for an application that uses a single
Xcode has a feature where each type of file has a template that is
XCode 3.1.2 using built-in OCTest unit testing. I'm getting a crash when unit tests
Xcode allows you to create automated scripts for performing repetitive tasks. What scripts have
Xcode automatically resizes and applies a glossy look to images added as the application
Xcode what is the key to tab into the next auto suggested parameter block?
Xcode is throwing an error at me: malloc: * error for object 0x103f000: pointer

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.