need it dual time display on Matrix LED

Hi friends,

I have a project with NTP clock with meteo data from openweathermap, for ESP8266 and MAX72219 matrix LED display. It show local time, then meteo data string and again local time.
Clock with local time and all is OK, but I need to add a string with UTC clock time , after strings with meteo data
original code here : code

Please post the code here using code tags when you do

it have another files code for load - time, ntp time and weather but this is the main

/*******************************************************************************************
 **                                www.bastelgarage.ch                                    **
 ** Der Onlineshop mit Videoanleitungen und kompletten Bausätzen für Anfänger und Profis! **
 *******************************************************************************************
 ** Autor: Alf Müller                                                                     **
 ** Datum: Mai 2018                                                                       **
 ** Version: 2.0                                                                          ** 
 ** Lizenz: CC BY-NC-ND 2.5 CH                                                            **
 *******************************************************************************************
*/

/************************( Importieren der genutzten Bibliotheken )************************/

#include "Arduino.h"
#include <ESP8266WiFi.h>                    // https://www.youtube.com/watch?v=vhm09S15toI
#include <ArduinoJson.h>                    // über Biblothek installieren
#include <Timezone.h>                       //https://github.com/JChristensen/Timezone
#include <TimeLib.h>                        //https://github.com/PaulStoffregen/Time
#include <WiFiUdp.h>


/************************************(Wifi Einstellungen)**********************************/
const char* ssid     = "Lager";     // SSID of local network
const char* password = "amlyamly4";   // Password on network

/**************************(openweathermap.org Einstellungen)*******************************/
String weatherKey = "your api key ";



String weatherLang = "&lang=en";
String cityID = "2661519"; //Biberist


// NTP Serverpool für die Schweiz:
static const char ntpServerName[] = "ch.pool.ntp.org";    //Finde lokale Server unter http://www.pool.ntp.org/zone/ch
const int timeZone = 0;                     // 0 wenn mit <Timezone.h> gearbeitet wird sonst stimmt es nachher nicht
WiFiUDP Udp;
unsigned int localPort = 8888;              // lokaler Port zum Abhören von UDP-Paketen
time_t getNtpTime();
void digitalClockDisplay();
void printDigits(int digits);
void sendNTPpacket(IPAddress &address);

// - Timezone. - //
// Bearbeiten Sie diese Zeilen entsprechend Ihrer Zeitzone und Sommerzeit.
// TimeZone Einstellungen Details https://github.com/JChristensen/Timezone
TimeChangeRule CEST = {"CEST", Last, Sun, Mar, 2, 120};     //Central European Time (Frankfurt, Paris)
TimeChangeRule CET = {"CET ", Last, Sun, Oct, 3, 60};       //Central European Time (Frankfurt, Paris)
Timezone CE(CEST, CET);

WiFiClient client;
/********************( Definieren der Globale Variablen und Konstanten)********************/
String weatherMain = "";
String weatherDescription = "";
String weatherLocation = "";
String country;
int humidity;
int pressure;
float temp;
float tempMin, tempMax;
int clouds;
float windSpeed;
int windDeg;
String date;

String WTemp, Datum, Zeit;
String weatherString;

#define NUM_MAX 4

// for ESP-01 module
//#define DIN_PIN 2 // D4
//#define CS_PIN  3 // D9/RX
//#define CLK_PIN 0 // D3

// for NodeMCU 1.0
#define DIN_PIN 15  // D8
#define CS_PIN  13  // D7
#define CLK_PIN 12  // D6

#include "max7219.h"
#include "fonts.h"


bool bNTPStarted = false;
bool gbIsConnecting = false;

#define MAX_DIGITS 16
byte dig[MAX_DIGITS] = {0};
byte digold[MAX_DIGITS] = {0};
byte digtrans[MAX_DIGITS] = {0};
int updCnt = 0;
int dots = 0;
long dotTime = 0;
long clkTime = 0;
int dx = 0;
int dy = 0;
byte del = 0;
int h, m, s, w, mo, ye, d;
const char* wochenstring;
float utcOffset = 2;
long localEpoc = 0;
long localMillisAtUpdate = 0;


/*****************************************( Setup )****************************************/
void setup()
{
  Serial.begin(115200);
  initMAX7219();
  sendCmdAll(CMD_SHUTDOWN, 1);
  sendCmdAll(CMD_INTENSITY, 0);
  Serial.print("Verbinde mit WiFi ");
  WiFi.begin(ssid, password);
  printStringWithShift("Verbinde", 15);
  while (WiFi.status() != WL_CONNECTED) {
    delay(500);
    Serial.print(".");
  }
  Serial.println("");
  Serial.print("Verbunden: "); Serial.println(WiFi.localIP());

  Udp.begin(localPort);
  Serial.print("lokaler Port: ");
  Serial.println(Udp.localPort());
  Serial.println("Warten auf die Synchronisation");
  setSyncProvider(getNtpTime);
  setSyncInterval(86400);                    // Anzahl der Sekunden zwischen dem erneuten Synchronisieren ein. 86400 = 1 Tag
}
/*************************************(Hauptprogramm)**************************************/
void loop()
{
  if (updCnt <= 0) { // every 10 scrolls, ~450s=7.5m
    updCnt = 10;
    Serial.println("Verbinde ...");
    getWeatherData();
    getTimeLocal();
    Serial.println("Daten geladen");
    clkTime = millis();
  }

  if (millis() - clkTime > 15000 && !del && dots) { // clock for 15s, then scrolls for about 30s
    printStringWithShift(weatherString.c_str(), 30);
    updCnt--;
    clkTime = millis();
  }

  if (millis() - dotTime > 500) {
    dotTime = millis();
    dots = !dots;
  }
  getTimeLocal();
  showAnimClock();
} :)

and here is code for time, modified by me, I added void getUTC ant if I replace in the main code getTimeLocal(); with getUTC(); , I see the UTC time; if let both and add delay, changes was made but display have a big lag between…

void getTimeLocal()
{
  time_t tT = now();
  // local time
  time_t tTlocal = CE.toLocal(tT);
  w = weekday(tTlocal);
  d = day(tTlocal);
  mo = month(tTlocal);
  ye = year(tTlocal);
  h = hour(tTlocal);
  m = minute(tTlocal);
  s = second(tTlocal);
  localMillisAtUpdate = millis();
  //client.stop();
}


void getUTC()
{  
  time_t utc = now();
//  tTlocal = utc;

  
  w = weekday(utc);
  d = day(utc);
  mo = month(utc);
  ye = year(utc);
  h = hour(utc);
  m = minute(utc);
  s = second(utc);
  
  
  
  localMillisAtUpdate = millis();
  //client.stop();
}



void showSimpleClock()
{
  dx = dy = 0;
  clr();
  showDigit(h / 10, 5, dig6x8);
  showDigit(h % 10, 14, dig6x8);
  showDigit(m / 10, 25, dig6x8);
  showDigit(m % 10, 33, dig6x8);
  showDigit(s / 10, 46, dig5x8rn);
  showDigit(s % 10, 53, dig5x8rn);
 
  setCol(23, dots ? B00101000 : 0);
  setCol(40, dots ? B00101000 : 0);
  refreshAll();
}

// =======================================================================

void showAnimClock()
{
 
  byte digPos[8] = {5, 13, 25, 33, 46, 54};
  int digHt = 12;
  int num = 6;
  int i;
  if (del == 0) {
    del = digHt;
    for (i = 0; i < num; i++) digold[i] = dig[i];
    
    dig[0] = h / 10 ? h / 10 : 10;
    dig[1] = h % 10;
    dig[2] = m / 10;
    dig[3] = m % 10;
    dig[4] = s / 10;
    dig[5] = s % 10;
    
    
    for (i = 0; i < num; i++)  digtrans[i] = (dig[i] == digold[i]) ? 0 : digHt;
  } else
    del--;

  clr();
  for (i = 0; i < num; i++) {
    if (digtrans[i] == 0) {
      dy = 0;
      showDigit(dig[i], digPos[i], dig6x8);
    } else {
      dy = digtrans[i] - digHt ;
      showDigit(digold[i], digPos[i], dig5x8rn);
      dy = +digtrans[i];
      showDigit(dig[i], digPos[i], dig5x8rn);
      digtrans[i]--;
    }
  }
  dy = 0;
  setCol(21, dots ? B1100110 : 24);
  setCol(22, dots ? B1100110 : 24);
  setCol(42, dots ? B1100110 : 24);
  setCol(43, dots ? B1100110 : 24);

 /* dy = 0;
  setCol(21, dots ? B00011000 : 0);
  setCol(22, dots ? B00011000 : 0);
  setCol(42, dots ? B00011000 : 0);
  setCol(43, dots ? B00011000 : 0);*/
  refreshAll();
  delay(30);
}

no tips... :confused:

then, how can I modify void loop, to run the same clock code again, after scrolling ?

how can I modify void loop, to run the same clock code again, after scrolling ?

What clock code do you want to run after scrolling ? The loop() function, by its nature, repeats the code within it or functions called from it unless there is logic present to prevent that happening or code that blocks the free running of the loop() function.