Skip to content

Commit 8307cfe

Browse files
authored
Merge pull request #723 from ackleymi/tz-fix
Adds missing tz for resetseqtime without starttime endtime
2 parents 4b8da8b + b2ba9cf commit 8307cfe

File tree

2 files changed

+22
-1
lines changed

2 files changed

+22
-1
lines changed

config/configuration.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -246,7 +246,7 @@ const (
246246
// - Comma delimited list of days of the week in English, or 3 letter abbreviation (e.g. "Monday,Tuesday,Wednesday" or "Mon,Tue,Wed" would both be valid values).
247247
Weekdays string = "Weekdays"
248248

249-
// TimeZone sets the time zone for this session; if specified, StartTime and EndTime will be converted from this zone to UTC.
249+
// TimeZone sets the time zone for this session; if specified, StartTime, EndTime, and ResetSeqTime will be converted from this zone to UTC.
250250
// Times in messages will still be set to UTC as this is required by FIX specifications.
251251
//
252252
// Required: No

session_factory.go

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -352,6 +352,27 @@ func (f sessionFactory) newSession(
352352
}
353353

354354
if settings.HasSetting(config.ResetSeqTime) {
355+
356+
if s.TimeZone == nil {
357+
loc := time.UTC
358+
if settings.HasSetting(config.TimeZone) {
359+
var locStr string
360+
if locStr, err = settings.Setting(config.TimeZone); err != nil {
361+
return
362+
}
363+
364+
loc, err = time.LoadLocation(locStr)
365+
if err != nil {
366+
err = errors.Wrapf(
367+
err, "problem parsing time zone '%v' for setting '%v",
368+
settings.settings[config.TimeZone], config.TimeZone,
369+
)
370+
return
371+
}
372+
}
373+
s.TimeZone = loc
374+
}
375+
355376
var seqTimeStr string
356377
if seqTimeStr, err = settings.Setting(config.ResetSeqTime); err != nil {
357378
return

0 commit comments

Comments
 (0)