Working fine now...
> repeat{
+ startTime <- now('Asia/Tokyo')
+ print(as.character(now('Asia/Tokyo')))
+ print(forecastData())
+ sleepTime <- startTime + 60*60 - now('Asia/Tokyo')
+ if (sleepTime > 0)
+ Sys.sleep(sleepTime)
+ }
[1] "2018-06-20 19:57:19"
.id ForecastDate.GMT Currency
1 EURUSD 2018-06-19 1.1756002
2 USDJPY 2018-06-19 110.4611047
3 GBPUSD 2018-06-19 1.3276902
4 USDCHF 2018-06-19 0.9869512
5 USDCAD 2018-06-19 1.2841243
6 AUDUSD 2018-06-19 0.7396868
[1] "2018-06-20 19:58:19"
.id ForecastDate.GMT Currency
1 EURUSD 2018-06-19 1.1756002
2 USDJPY 2018-06-19 110.4611047
3 GBPUSD 2018-06-19 1.3276902
4 USDCHF 2018-06-19 0.9869512
5 USDCAD 2018-06-19 1.2841243
6 AUDUSD 2018-06-19 0.7396868
[1] "2018-06-20 19:59:19"
.id ForecastDate.GMT Currency
1 EURUSD 2018-06-19 1.1756002
2 USDJPY 2018-06-19 110.4611047
3 GBPUSD 2018-06-19 1.3276902
4 USDCHF 2018-06-19 0.9869512
5 USDCAD 2018-06-19 1.2841243
6 AUDUSD 2018-06-19 0.7396868
Test the time unit for rescheduled task...
> startTime <- now('Asia/Tokyo')
> startTime + 24*60*60 - now('Asia/Tokyo')
Time difference of 24 hours