GameLiftServerSDKWrapper.cpp 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  1. /*
  2. * All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or
  3. * its licensors.
  4. *
  5. * For complete copyright and license terms please see the LICENSE at the root of this
  6. * distribution (the "License"). All use of this software is governed by the License,
  7. * or, if provided, by the license below or the license accompanying this file. Do not
  8. * remove or modify any license notices. This file is distributed on an "AS IS" BASIS,
  9. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  10. *
  11. */
  12. #include <GameLiftServerSDKWrapper.h>
  13. #include <ctime>
  14. #pragma warning(disable : 4996)
  15. namespace AWSGameLift
  16. {
  17. Aws::GameLift::GenericOutcome GameLiftServerSDKWrapper::AcceptPlayerSession(const std::string& playerSessionId)
  18. {
  19. return Aws::GameLift::Server::AcceptPlayerSession(playerSessionId);
  20. }
  21. Aws::GameLift::GenericOutcome GameLiftServerSDKWrapper::ActivateGameSession()
  22. {
  23. return Aws::GameLift::Server::ActivateGameSession();
  24. }
  25. Aws::GameLift::Server::InitSDKOutcome GameLiftServerSDKWrapper::InitSDK()
  26. {
  27. return Aws::GameLift::Server::InitSDK();
  28. }
  29. Aws::GameLift::GenericOutcome GameLiftServerSDKWrapper::ProcessReady(
  30. const Aws::GameLift::Server::ProcessParameters& processParameters)
  31. {
  32. return Aws::GameLift::Server::ProcessReady(processParameters);
  33. }
  34. Aws::GameLift::GenericOutcome GameLiftServerSDKWrapper::ProcessEnding()
  35. {
  36. return Aws::GameLift::Server::ProcessEnding();
  37. }
  38. AZStd::string GameLiftServerSDKWrapper::GetTerminationTime()
  39. {
  40. // Timestamp format is using the UTC ISO8601 format
  41. std::time_t terminationTime;
  42. Aws::GameLift::AwsLongOutcome GetTerminationTimeOutcome = Aws::GameLift::Server::GetTerminationTime();
  43. if (GetTerminationTimeOutcome.IsSuccess())
  44. {
  45. terminationTime = GetTerminationTimeOutcome.GetResult();
  46. }
  47. else
  48. {
  49. // Use the current system time if the termination time is not available from GameLift.
  50. time(&terminationTime);
  51. }
  52. char buffer[50];
  53. strftime(buffer, sizeof(buffer), "%FT%TZ", gmtime(&terminationTime));
  54. return AZStd::string(buffer);
  55. }
  56. Aws::GameLift::GenericOutcome GameLiftServerSDKWrapper::RemovePlayerSession(const AZStd::string& playerSessionId)
  57. {
  58. return Aws::GameLift::Server::RemovePlayerSession(playerSessionId.c_str());
  59. }
  60. } // namespace AWSGameLift