Online and Offline Clustering of Stationary Ergodic Time Series