4 Replies - 744 Views - Last Post: 28 July 2011 - 07:02 AM Rate Topic: -----

#1 Sledvora  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 2
  • Joined: 28-July 11

sending message at specific time in various timezones

Posted 28 July 2011 - 04:51 AM

I am writing an application in C# which has to send a message for a
particular country at midnight (localtime). I have about 100 such
countries and I have to also be mindful of daylight savings. I can
only think of 2 ways to do this:

1. Create a corresponding thread for each country and which wakes up
every hour or so and checks if it is midnight(local time) and send out
the message. So essentially, I will be creating 100 threads doing
nothing most of the time.

2. In this approach, there will be only one timer which checks every
minute or 30 secs the local time for 100 countries and send message.
There will need to be some extra logic as there will never be an exact
midnight match, so it should be within a set window of time.

Not sure, if there is any better way to tackle above situation. It
would be great if I can get some ideas/suggestions here.

Thanks,
SL

Is This A Good Question/Topic? 0
  • +

Replies To: sending message at specific time in various timezones

#2 wiero  Icon User is offline

  • D.I.C Head

Reputation: 48
  • View blog
  • Posts: 78
  • Joined: 29-June 11

Re: sending message at specific time in various timezones

Posted 28 July 2011 - 06:05 AM

hi,
in my projects i use Quartz.Net for task scheduling.
http://quartznet.sourceforge.net/
Was This Post Helpful? 1
  • +
  • -

#3 Sergio Tapia  Icon User is offline

  • D.I.C Lover
  • member icon

Reputation: 1253
  • View blog
  • Posts: 4,168
  • Joined: 27-January 10

Re: sending message at specific time in various timezones

Posted 28 July 2011 - 06:10 AM

Create a collection of countries according to GMT.

Ping the message to countries at Midnight with GMT, then on the hour, ping the countries with GMT-1, then GMT-2.

You'll have to do some manual work to find out the GMT of each country and then assorting them into groups, but after that it's smooth sailing.
Was This Post Helpful? 0
  • +
  • -

#4 ragingben  Icon User is offline

  • D.I.C Addict
  • member icon

Reputation: 170
  • View blog
  • Posts: 637
  • Joined: 07-October 08

Re: sending message at specific time in various timezones

Posted 28 July 2011 - 06:10 AM

How about just one background thread that checks every 30 seconds or so (unless it is already running), which determines which countries need the message send, and then sends it for each country (could be on additional threads, or just on this background thread)?
Was This Post Helpful? 0
  • +
  • -

#5 Sledvora  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 2
  • Joined: 28-July 11

Re: sending message at specific time in various timezones

Posted 28 July 2011 - 07:02 AM

Thank you all for the prompt response. I have all the countries with corresponding UTC times, so sorting those countries by UTC times and processing every hour would be much easier.

SL.
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1