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 8882961
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T20:42:08+00:00 2026-06-14T20:42:08+00:00

I am developing a digital clock for windows 8 app. And strangely some random

  • 0

I am developing a digital clock for windows 8 app.

And strangely some random second is being skipped in every minute. I am not sure why it is happening. One of my guesses is it might be because sometimes to retrieve that custom second image its taking more than a second and hence the next second gets skipped.

This is my code in XAML

<!-- second -->
                <Grid Grid.Row="1" VerticalAlignment="Bottom" HorizontalAlignment="Left" Margin="-15,0,0,0">
                    <Grid.ColumnDefinitions>
                        <ColumnDefinition />
                        <ColumnDefinition />
                    </Grid.ColumnDefinitions>
                    <Image Grid.Column="0"

                        Source="{Binding CurrentTime, Converter={StaticResource ThemeTimeConverterSecondDigit1}}" Opacity="0.99" Stretch="None" />
                    <Image Grid.Column="1"

                        Source="{Binding CurrentTime, Converter={StaticResource ThemeTimeConverterSecondDigit2}}" Opacity="0.99" Stretch="None" Margin="-30,0,0,0" />
                </Grid>

The binding variable Current Time gives me the time and i use a converter to get the custom image for that time.

This is the code for my converter

public object Convert(object value, Type targetType, object parameter, string language)
    {
        if (!(value is DateTime))
        {
            return value;
        }


        System.DateTime currentDate = DateTime.Now;

        var dt = (DateTime)value;

        var timePeriod = dt.ToString("tt ").StartsWith("A") ? TimePeriod.AM : TimePeriod.PM;

        if (!this.IsTwentyFourHour && dt.Hour > 12)
        {
            dt = dt.Subtract(TimeSpan.FromHours(12));
        }

        switch (this.Component)
        {

            case ThemeComponents.SecondDigit1:
                {
                    var sec = _GetFirstDigit(dt.Second);
                    return this.CurrentTheme.SmallDigits.Where(d => d.Value == sec).First().Image;
                }
            case ThemeComponents.SecondDigit2:
                {
                    var sec = _GetSecondDigit(dt.Second);
                    return this.CurrentTheme.SmallDigits.Where(d => d.Value == sec).First().Image;
                }
}


private int _GetFirstDigit(int number)
    {
        if (number >= 10)
        {
            return System.Convert.ToInt32(number.ToString().Substring(0, 1));
        }

        return 0;
    }

    private int _GetSecondDigit(int number)
    {
        if (number >= 10)
        {
            return System.Convert.ToInt32(number.ToString().Substring(1, 1));
        }

        return System.Convert.ToInt32(number.ToString().Substring(0, 1));
    }

Please give me your views on why this might be happening or if u have any better ways to implement it. Thanks

EDIT:

I replaced the images with text blocks and gave just plain numbers and its still happening. The seconds are still being skipped

EDIT:
This is the code for how the Current time is set

 var timeoutputShown = false;

        _ClockTimer = new DispatcherTimer();
        _ClockTimer.Interval = TimeSpan.FromMilliseconds(1000);
        _ClockTimer.Tick += (s, e) =>
        {
            App.ViewModel.CurrentTime = DateTime.Now;

            if (!timeoutputShown)
            {
                timeoutputShown = true;
                //ShowTimePanelStoryboard.Begin();
            }
        };

Answer:

I reduced the interval from 1000ms to 100ms and that did it. Thanks a lot everyone.

  • 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-14T20:42:09+00:00Added an answer on June 14, 2026 at 8:42 pm

    If you are ticking your timer at 1 second intervals, then you effectively have a margin of error of 1 second too, and therefore the dispatcher queue only needs to be held for a small amount of time in order to drop a second from being displayed. You might be better to run your timer at a higher frequency so you have less of a window for error, and do less work because you are going to be called so frequently.

    For example if you run your timer to tick every 0.1secs or 100ms then you can update the seconds up to 10 times a second, and then only draw screen updates when the value to display actually changes.

    So for example in a clock that only shows seconds we could do;

    Public void timer_tick(…)
    {
    MySeconds = DateTime.Now.Seconds:
    }

    Where

    Public int MySeconds
    {
    set
    {
    // Only if the second has actually changed
    if (_mySeconds != value)
    {
    _mySeconds = value;
    NotifyPropertyChanged(…);
    }
    }
    }

    The trick is to do as little as possible at each stage.

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

Sidebar

Related Questions

I am developing a windows 8 app which has a digital clock. I am
Developing an app where all tabular data is returned as an object. Some cells
I'm developing a simple alarm clock app and I use a OnSharedPreferenceChangeListener to display
Hi I am developing a android application to show the digital clock.But I need
I'm developing a specialist app which generates digital output (a spreadsheet) depending on a
I'm developing an app where the user can purchase digital maps, charts and so
The application I'm developing communicates with an digital audio device, which is capable of
Developing a project of mine I realize I have a need for some level
Im developing an app for iPhone, in wich one of the functionalities is an
Disclaimer:It's my first time developing an app that will be on a tablet style

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.